setup_git_env: convert die("BUG") to BUG()

Converting to BUG() makes it easier to detect and debug
cases where we hit this assertion. Coupled with a new test
in t1300, this shows that the test suite can detect such
corner cases.

Signed-off-by: Jeff King <>
Signed-off-by: Junio C Hamano <>
This commit is contained in:
Jeff King 2017-05-12 23:29:18 -04:00 committed by Junio C Hamano
parent d8193743e0
commit 588a538ae5
2 changed files with 7 additions and 1 deletions

View File

@ -169,7 +169,7 @@ static void setup_git_env(void)
git_dir = getenv(GIT_DIR_ENVIRONMENT);
if (!git_dir) {
if (!startup_info->have_repository)
die("BUG: setup_git_env called without repository");
BUG("setup_git_env called without repository");
gitfile = read_gitfile(git_dir);

View File

@ -1539,4 +1539,10 @@ test_expect_success !MINGW '--show-origin blob ref' '
test_cmp expect output
test_expect_failure '--local requires a repo' '
# we expect 128 to ensure that we do not simply
# fail to find anything and return code "1"
test_expect_code 128 nongit git config --local