Merge branch 'jc/you-still-use-whatchanged'

"git whatchanged" that is longer to type than "git log --raw"
which is its modern rough equivalent has outlived its usefulness
more than 10 years ago.  Plan to deprecate and remove it.

* jc/you-still-use-whatchanged:
  whatschanged: list it in BreakingChanges document
  whatchanged: remove when built with WITH_BREAKING_CHANGES
  whatchanged: require --i-still-use-this
  tests: prepare for a world without whatchanged
  doc: prepare for a world without whatchanged
  you-still-use-that??: help deprecating commands for removal
This commit is contained in:
Junio C Hamano
2025-06-25 14:07:35 -07:00
21 changed files with 152 additions and 39 deletions

View File

@@ -206,14 +206,30 @@ do
expect="$TEST_DIRECTORY/t4013/diff.$test"
actual="$pfx-diff.$test"
test_expect_success "git $cmd # magic is ${magic:-(not used)}" '
case "$cmd" in
whatchanged | whatchanged" "*)
prereq=!WITH_BREAKING_CHANGES
;;
*)
prereq=;;
esac
test_expect_success $prereq "git $cmd # magic is ${magic:-(not used)}" '
{
echo "$ git $cmd"
case "$cmd" in
whatchanged | whatchanged" "*)
run="whatchanged --i-still-use-this"
run="$run ${cmd#whatchanged}" ;;
*)
run=$cmd ;;
esac &&
case "$magic" in
"")
GIT_PRINT_SHA1_ELLIPSIS=yes git $cmd ;;
GIT_PRINT_SHA1_ELLIPSIS=yes git $run ;;
noellipses)
git $cmd ;;
git $run ;;
esac |
sed -e "s/^\\(-*\\)$V\\(-*\\)\$/\\1g-i-t--v-e-r-s-i-o-n\2/" \
-e "s/^\\(.*mixed; boundary=\"-*\\)$V\\(-*\\)\"\$/\\1g-i-t--v-e-r-s-i-o-n\2\"/"
@@ -460,6 +476,11 @@ diff-tree --stat --compact-summary initial mode
diff-tree -R --stat --compact-summary initial mode
EOF
test_expect_success !WITH_BREAKING_CHANGES 'whatchanged needs --i-still-use-this' '
test_must_fail git whatchanged >message 2>&1 &&
test_grep "nominated for removal" message
'
test_expect_success 'log -m matches pure log' '
git log master >result &&
process_diffs result >expected &&

View File

@@ -486,10 +486,16 @@ test_expect_success !FAIL_PREREQS 'log with various grep.patternType configurati
)
'
for cmd in show whatchanged reflog format-patch
cmds="show reflog format-patch"
if test_have_prereq !WITH_BREAKING_CHANGES
then
cmds="$cmds whatchanged"
fi
for cmd in $cmds
do
case "$cmd" in
format-patch) myarg="HEAD~.." ;;
whatchanged) myarg=--i-still-use-this ;;
*) myarg= ;;
esac
@@ -1201,20 +1207,27 @@ test_expect_success 'reflog is expected format' '
test_cmp expect actual
'
test_expect_success 'whatchanged is expected format' '
test_expect_success !WITH_BREAKING_CHANGES 'whatchanged is expected format' '
whatchanged="whatchanged --i-still-use-this" &&
git log --no-merges --raw >expect &&
git whatchanged >actual &&
git $whatchanged >actual &&
test_cmp expect actual
'
test_expect_success 'log.abbrevCommit configuration' '
whatchanged="whatchanged --i-still-use-this" &&
git log --abbrev-commit >expect.log.abbrev &&
git log --no-abbrev-commit >expect.log.full &&
git log --pretty=raw >expect.log.raw &&
git reflog --abbrev-commit >expect.reflog.abbrev &&
git reflog --no-abbrev-commit >expect.reflog.full &&
git whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
git whatchanged --no-abbrev-commit >expect.whatchanged.full &&
if test_have_prereq !WITH_BREAKING_CHANGES
then
git $whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
git $whatchanged --no-abbrev-commit >expect.whatchanged.full
fi &&
test_config log.abbrevCommit true &&
@@ -1231,10 +1244,13 @@ test_expect_success 'log.abbrevCommit configuration' '
git reflog --no-abbrev-commit >actual &&
test_cmp expect.reflog.full actual &&
git whatchanged >actual &&
test_cmp expect.whatchanged.abbrev actual &&
git whatchanged --no-abbrev-commit >actual &&
test_cmp expect.whatchanged.full actual
if test_have_prereq !WITH_BREAKING_CHANGES
then
git $whatchanged >actual &&
test_cmp expect.whatchanged.abbrev actual &&
git $whatchanged --no-abbrev-commit >actual &&
test_cmp expect.whatchanged.full actual
fi
'
test_expect_success '--abbrev-commit with core.abbrev=false' '

View File

@@ -45,6 +45,11 @@ fi
main_repo=main.git
shared_repo=shared.git
test_expect_success 'pack-redundant needs --i-still-use-this' '
test_must_fail git pack-redundant >message 2>&1 &&
test_grep "nominated for removal" message
'
git_pack_redundant='git pack-redundant --i-still-use-this'
# Create commits in <repo> and assign each commit's oid to shell variables

View File

@@ -120,7 +120,7 @@ test_expect_success 'A: create pack from stdin' '
INPUT_END
git fast-import --export-marks=marks.out <input &&
git whatchanged main
git log --raw main
'
test_expect_success 'A: verify pack' '
@@ -279,7 +279,7 @@ test_expect_success 'A: verify marks import does not crash' '
INPUT_END
git fast-import --import-marks=marks.out <input &&
git whatchanged verify--import-marks
git log --raw verify--import-marks
'
test_expect_success 'A: verify pack' '
@@ -652,7 +652,7 @@ test_expect_success 'C: incremental import create pack from stdin' '
INPUT_END
git fast-import <input &&
git whatchanged branch
git log --raw branch
'
test_expect_success 'C: verify pack' '
@@ -715,7 +715,7 @@ test_expect_success 'D: inline data in commit' '
INPUT_END
git fast-import <input &&
git whatchanged branch
git log --raw branch
'
test_expect_success 'D: verify pack' '
@@ -882,7 +882,7 @@ test_expect_success 'H: deletall, add 1' '
INPUT_END
git fast-import <input &&
git whatchanged H
git log --raw H
'
test_expect_success 'H: verify pack' '
@@ -2066,7 +2066,7 @@ test_expect_success 'Q: commit notes' '
INPUT_END
git fast-import <input &&
git whatchanged notes-test
git log --raw notes-test
'
test_expect_success 'Q: verify pack' '

View File

@@ -76,7 +76,7 @@ INPUT_END
test_expect_success 'set up main branch' '
git fast-import <input &&
git whatchanged main
git log --raw main
'
commit4=$(git rev-parse refs/heads/main)