Skip to content

Commit 8423083

Browse files
avargitster
authored andcommitted
config tests: simplify include cycle test
Simplify an overly verbose test added in 9b25a0b ("config: add include directive", 2012-02-06). The "expect" file was never used, and by using .gitconfig it's not as intuitive to reproduce this manually with "-d" as some other tests, since HOME needs to be set in the environment. Also remove the use of test_i18ngrep added in a769bfc ("config.c: mark more strings for translation", 2018-07-21) in favor of overriding the GIT_TEST_GETTEXT_POISON value. Using the i18n test wrappers hasn't been needed since my 6cdccfc ("i18n: make GETTEXT_POISON a runtime option", 2018-11-08). As a follow-up change to the yet-to-be-added t0017-env-helper.sh will show, doing it this way can hide a regression when combined with trace2's early config reading. That early config reading was added in bce9db6 ("trace2: use system/global config for default trace2 settings", 2019-04-15). So let's remove the testing for that potential regression here, I'll instead add it explicitly to t0017-env-helper.sh in a follow-up change. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent a6a95cd commit 8423083

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

t/t1305-config-include.sh

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -310,20 +310,13 @@ test_expect_success SYMLINKS 'conditional include, gitdir matching symlink, icas
310310
'
311311

312312
test_expect_success 'include cycles are detected' '
313-
cat >.gitconfig <<-\EOF &&
314-
[test]value = gitconfig
315-
[include]path = cycle
316-
EOF
317-
cat >cycle <<-\EOF &&
318-
[test]value = cycle
319-
[include]path = .gitconfig
320-
EOF
321-
cat >expect <<-\EOF &&
322-
gitconfig
323-
cycle
324-
EOF
325-
test_must_fail git config --get-all test.value 2>stderr &&
326-
test_i18ngrep "exceeded maximum include depth" stderr
313+
git init --bare cycle &&
314+
git -C cycle config include.path cycle &&
315+
git config -f cycle/cycle include.path config &&
316+
test_must_fail \
317+
env GIT_TEST_GETTEXT_POISON= \
318+
git -C cycle config --get-all test.value 2>stderr &&
319+
grep "exceeded maximum include depth" stderr
327320
'
328321

329322
test_done

0 commit comments

Comments
 (0)