]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t0012: verify that built-ins handle `-h` even without gitdir
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Tue, 8 Feb 2022 11:21:54 +0000 (11:21 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 8 Feb 2022 17:54:44 +0000 (09:54 -0800)
We just fixed a class of recently introduced bugs where calling, say,
`git fetch -h` outside a repository would not show the usage but instead
show an ugly `BUG` message.

Let's verify that this does not regress anymore.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t0012-help.sh

index 91b68c74a154a97c50f1011ebf5ec70c2ce66a33..cbd725ccac875a4ee387c0100c4b8e12d4194441 100755 (executable)
@@ -139,13 +139,18 @@ test_expect_success 'git help --config-sections-for-completion' '
 '
 
 test_expect_success 'generate builtin list' '
+       mkdir -p sub &&
        git --list-cmds=builtins >builtins
 '
 
 while read builtin
 do
        test_expect_success "$builtin can handle -h" '
-               test_expect_code 129 git $builtin -h >output 2>&1 &&
+               (
+                       GIT_CEILING_DIRECTORIES=$(pwd) &&
+                       export GIT_CEILING_DIRECTORIES &&
+                       test_expect_code 129 git -C sub $builtin -h >output 2>&1
+               ) &&
                test_i18ngrep usage output
        '
 done <builtins