]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'ab/test-env'
authorJunio C Hamano <gitster@pobox.com>
Thu, 25 Jul 2019 20:59:20 +0000 (13:59 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 25 Jul 2019 20:59:20 +0000 (13:59 -0700)
Many GIT_TEST_* environment variables control various aspects of
how our tests are run, but a few followed "non-empty is true, empty
or unset is false" while others followed the usual "there are a few
ways to spell true, like yes, on, etc., and also ways to spell
false, like no, off, etc." convention.

* ab/test-env:
  env--helper: mark a file-local symbol as static
  tests: make GIT_TEST_FAIL_PREREQS a boolean
  tests: replace test_tristate with "git env--helper"
  tests README: re-flow a previously changed paragraph
  tests: make GIT_TEST_GETTEXT_POISON a boolean
  t6040 test: stop using global "script" variable
  config.c: refactor die_bad_number() to not call gettext() early
  env--helper: new undocumented builtin wrapping git_env_*()
  config tests: simplify include cycle test

1  2 
.gitignore
Makefile
builtin.h
ci/lib.sh
config.c
gettext.c
git.c
t/t1305-config-include.sh
t/t6040-tracking-info.sh
t/test-lib-functions.sh
t/test-lib.sh

diff --cc .gitignore
Simple merge
diff --cc Makefile
Simple merge
diff --cc builtin.h
Simple merge
diff --cc ci/lib.sh
Simple merge
diff --cc config.c
Simple merge
diff --cc gettext.c
Simple merge
diff --cc git.c
Simple merge
index 9571e366f801ea347845eef9736c92197fbdba08,de294c990e19b4aec8b6f4bed1c34518adeda79f..d20b4d150d42c9fd6c14eb5f36e01a442d045cee
@@@ -309,60 -309,14 +309,53 @@@ test_expect_success SYMLINKS 'condition
        )
  '
  
 +test_expect_success 'conditional include, onbranch' '
 +      echo "[includeIf \"onbranch:foo-branch\"]path=bar9" >>.git/config &&
 +      echo "[test]nine=9" >.git/bar9 &&
 +      git checkout -b master &&
 +      test_must_fail git config test.nine &&
 +      git checkout -b foo-branch &&
 +      echo 9 >expect &&
 +      git config test.nine >actual &&
 +      test_cmp expect actual
 +'
 +
 +test_expect_success 'conditional include, onbranch, wildcard' '
 +      echo "[includeIf \"onbranch:?oo-*/**\"]path=bar10" >>.git/config &&
 +      echo "[test]ten=10" >.git/bar10 &&
 +      git checkout -b not-foo-branch/a &&
 +      test_must_fail git config test.ten &&
 +
 +      echo 10 >expect &&
 +      git checkout -b foo-branch/a/b/c &&
 +      git config test.ten >actual &&
 +      test_cmp expect actual &&
 +
 +      git checkout -b moo-bar/a &&
 +      git config test.ten >actual &&
 +      test_cmp expect actual
 +'
 +
 +test_expect_success 'conditional include, onbranch, implicit /** for /' '
 +      echo "[includeIf \"onbranch:foo-dir/\"]path=bar11" >>.git/config &&
 +      echo "[test]eleven=11" >.git/bar11 &&
 +      git checkout -b not-foo-dir/a &&
 +      test_must_fail git config test.eleven &&
 +
 +      echo 11 >expect &&
 +      git checkout -b foo-dir/a/b/c &&
 +      git config test.eleven >actual &&
 +      test_cmp expect actual
 +'
 +
  test_expect_success 'include cycles are detected' '
-       cat >.gitconfig <<-\EOF &&
-       [test]value = gitconfig
-       [include]path = cycle
-       EOF
-       cat >cycle <<-\EOF &&
-       [test]value = cycle
-       [include]path = .gitconfig
-       EOF
-       cat >expect <<-\EOF &&
-       gitconfig
-       cycle
-       EOF
-       test_must_fail git config --get-all test.value 2>stderr &&
-       test_i18ngrep "exceeded maximum include depth" stderr
+       git init --bare cycle &&
+       git -C cycle config include.path cycle &&
+       git config -f cycle/cycle include.path config &&
+       test_must_fail \
+               env GIT_TEST_GETTEXT_POISON=false \
+               git -C cycle config --get-all test.value 2>stderr &&
+       grep "exceeded maximum include depth" stderr
  '
  
  test_done
Simple merge
Simple merge
diff --cc t/test-lib.sh
Simple merge