Merge branch 'jk/t0014-dynamic-deprecated-cmds'

The alias tests in 't/t0014-alias.sh' have been updated to dynamically
query the list of deprecated commands using 'git
--list-cmds=deprecated' to avoid test failures when running with
'WITH_BREAKING_CHANGES' in a build directory that contains stale
executables of formerly deprecated commands.

* jk/t0014-dynamic-deprecated-cmds:
  t0014: generate deprecated command names dynamically
  t0014: factor out choice of deprecated commands
This commit is contained in:
Junio C Hamano
2026-08-05 11:10:52 -07:00

View File

@@ -27,17 +27,25 @@ test_expect_success 'looping aliases - internal execution' '
test_grep "^fatal: alias loop detected: expansion of" output
'
test_expect_success 'looping aliases - deprecated builtins' '
test_config alias.whatchanged pack-redundant &&
test_config alias.pack-redundant whatchanged &&
test_expect_success 'detect deprecated commands' '
git --list-cmds=deprecated >deprecated &&
if read deprecated1 && read deprecated2
then
test_set_prereq HAVE_DEPRECATED
fi <deprecated
'
test_expect_success HAVE_DEPRECATED 'looping aliases - deprecated builtins' '
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
'
@@ -86,12 +94,12 @@ test_expect_success 'can alias-shadow deprecated builtins' '
done
'
test_expect_success 'can alias-shadow via two deprecated builtins' '
test_expect_success HAVE_DEPRECATED '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
'