t0014: factor out choice of deprecated commands
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>
Jeff King committed
Jul 28, 2026 at 10:37 UTC
b678bb728331fbc575b8eee7948f08eec167d951
1 file changed
+13
-10
t/t0014-alias.sh
+13
-10
@@ -27,17 +27,20 @@ test_expect_success 'looping aliases - internal execution' '
27
test_grep "^fatal: alias loop detected: expansion of" output
28
'
29
30
+deprecated1=whatchanged
31
+deprecated2=pack-redundant
32
+
33
test_expect_success 'looping aliases - deprecated builtins' '
31
- test_config alias.whatchanged pack-redundant &&
32
- test_config alias.pack-redundant whatchanged &&
34
+ test_config alias.$deprecated1 $deprecated2 &&
35
+ test_config alias.$deprecated2 $deprecated1 &&
36
cat >expect <<-EOF &&
34
- ${SQ}whatchanged${SQ} is aliased to ${SQ}pack-redundant${SQ}
35
- ${SQ}pack-redundant${SQ} is aliased to ${SQ}whatchanged${SQ}
36
- fatal: alias loop detected: expansion of ${SQ}whatchanged${SQ} does not terminate:
37
- whatchanged <==
38
- pack-redundant ==>
37
+ ${SQ}$deprecated1${SQ} is aliased to ${SQ}$deprecated2${SQ}
38
+ ${SQ}$deprecated2${SQ} is aliased to ${SQ}$deprecated1${SQ}
39
+ fatal: alias loop detected: expansion of ${SQ}$deprecated1${SQ} does not terminate:
40
+ $deprecated1 <==
41
+ $deprecated2 ==>
42
EOF
40
- test_must_fail git whatchanged -h 2>actual &&
43
+ test_must_fail git $deprecated1 -h 2>actual &&
44
test_cmp expect actual
45
'
46
@@ -90,8 +93,8 @@ test_expect_success 'can alias-shadow via two deprecated builtins' '
93
# some git(1) commands will fail... (see above)
94
test_might_fail git status -h >expect &&
95
test_file_not_empty expect &&
93
- test_might_fail git -c alias.whatchanged=pack-redundant \
94
- -c alias.pack-redundant=status whatchanged -h >actual &&
96
+ test_might_fail git -c alias.$deprecated1=$deprecated2 \
97
+ -c alias.$deprecated2=status $deprecated1 -h >actual &&
98
test_cmp expect actual
99
'
100