]> git.ipfire.org Git - thirdparty/git.git/commitdiff
t0014: factor out choice of deprecated commands
authorJeff King <peff@peff.net>
Tue, 28 Jul 2026 14:37:26 +0000 (10:37 -0400)
committerJunio C Hamano <gitster@pobox.com>
Tue, 28 Jul 2026 22:43:32 +0000 (15:43 -0700)
We have a few tests related to aliasing deprecated commands which use
"whatchanged" and "pack-redundant", as these are the only two deprecated
commands we have. Let's pull those names into variables so that we can
refactor the tests without relying on the specific names.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t0014-alias.sh

index 5144b0effd78aab5e82f50723c5f930d07038d6a..9d7c7373552350308d24f9a907b4e9d34e318952 100755 (executable)
@@ -27,17 +27,20 @@ test_expect_success 'looping aliases - internal execution' '
        test_grep "^fatal: alias loop detected: expansion of" output
 '
 
+deprecated1=whatchanged
+deprecated2=pack-redundant
+
 test_expect_success 'looping aliases - deprecated builtins' '
-       test_config alias.whatchanged pack-redundant &&
-       test_config alias.pack-redundant whatchanged &&
+       test_config alias.$deprecated1 $deprecated2 &&
+       test_config alias.$deprecated2 $deprecated1 &&
        cat >expect <<-EOF &&
-       ${SQ}whatchanged${SQ} is aliased to ${SQ}pack-redundant${SQ}
-       ${SQ}pack-redundant${SQ} is aliased to ${SQ}whatchanged${SQ}
-       fatal: alias loop detected: expansion of ${SQ}whatchanged${SQ} does not terminate:
-         whatchanged <==
-         pack-redundant ==>
+       ${SQ}$deprecated1${SQ} is aliased to ${SQ}$deprecated2${SQ}
+       ${SQ}$deprecated2${SQ} is aliased to ${SQ}$deprecated1${SQ}
+       fatal: alias loop detected: expansion of ${SQ}$deprecated1${SQ} does not terminate:
+         $deprecated1 <==
+         $deprecated2 ==>
        EOF
-       test_must_fail git whatchanged -h 2>actual &&
+       test_must_fail git $deprecated1 -h 2>actual &&
        test_cmp expect actual
 '
 
@@ -90,8 +93,8 @@ test_expect_success 'can alias-shadow via two deprecated builtins' '
        # some git(1) commands will fail... (see above)
        test_might_fail git status -h >expect &&
        test_file_not_empty expect &&
-       test_might_fail git -c alias.whatchanged=pack-redundant \
-               -c alias.pack-redundant=status whatchanged -h >actual &&
+       test_might_fail git -c alias.$deprecated1=$deprecated2 \
+               -c alias.$deprecated2=status $deprecated1 -h >actual &&
        test_cmp expect actual
 '