From: Junio C Hamano Date: Wed, 18 Jun 2025 20:57:41 +0000 (-0700) Subject: Merge branch 'jc/you-still-use-whatchanged' into next X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b28af0a02ca33145e08f2a8ff6afb4d5198a823c;p=thirdparty%2Fgit.git Merge branch 'jc/you-still-use-whatchanged' into next "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 --- b28af0a02ca33145e08f2a8ff6afb4d5198a823c diff --cc Documentation/BreakingChanges.adoc index 61bdd586b9,ac9a84c17b..c6bd94986c --- a/Documentation/BreakingChanges.adoc +++ b/Documentation/BreakingChanges.adoc @@@ -178,11 -178,14 +178,19 @@@ references + These features will be removed. +* Support for "--stdin" option in the "name-rev" command was + deprecated (and hidden from the documentation) in the Git 2.40 + timeframe, in preference to its synonym "--annotate-stdin". Git 3.0 + removes the support for "--stdin" altogether. + + * The git-whatchanged(1) command has outlived its usefulness more than + 10 years ago, and takes more keystrokes to type than its rough + equivalent `git log --raw`. We have nominated the command for + removal, have changed the command to refuse to work unless the + `--i-still-use-this` option is given, and asked the users to report + when they do so. So far there hasn't been a single complaint. + + + The command will be removed. == Superseded features that will not be deprecated diff --cc Documentation/Makefile index b109d25e9c,671267a8ac..df2ce187eb --- a/Documentation/Makefile +++ b/Documentation/Makefile @@@ -510,7 -509,7 +510,12 @@@ lint-docs-meson awk "/^manpages = {$$/ {flag=1 ; next } /^}$$/ { flag=0 } flag { gsub(/^ \047/, \"\"); gsub(/\047 : [157],\$$/, \"\"); print }" meson.build | \ grep -v -e '#' -e '^$$' | \ sort >tmp-meson-diff/meson.adoc && \ - ls git*.adoc scalar.adoc | grep -v -e git-bisect-lk2009.adoc -e git-pack-redundant.adoc -e git-tools.adoc >tmp-meson-diff/actual.adoc && \ - ls git*.adoc scalar.adoc | grep -v -e git-bisect-lk2009.adoc -e git-tools.adoc >tmp-meson-diff/actual.adoc && \ ++ ls git*.adoc scalar.adoc | \ ++ grep -v -e git-bisect-lk2009.adoc \ ++ -e git-pack-redundant.adoc \ ++ -e git-tools.adoc \ ++ -e git-whatchanged.adoc \ ++ >tmp-meson-diff/actual.adoc && \ if ! cmp tmp-meson-diff/meson.adoc tmp-meson-diff/actual.adoc; then \ echo "Meson man pages differ from actual man pages:"; \ diff -u tmp-meson-diff/meson.adoc tmp-meson-diff/actual.adoc; \ diff --cc Documentation/MyFirstObjectWalk.adoc index b7b2adc5de,102a465a48..413a9fdb05 --- a/Documentation/MyFirstObjectWalk.adoc +++ b/Documentation/MyFirstObjectWalk.adoc @@@ -83,13 -83,13 +83,13 @@@ int cmd_walken(int argc, const char **a } ---- - Also add the relevant line in `builtin.h` near `cmd_whatchanged()`: + Also add the relevant line in `builtin.h` near `cmd_version()`: ---- -int cmd_walken(int argc, const char **argv, const char *prefix); +int cmd_walken(int argc, const char **argv, const char *prefix, struct repository *repo); ---- - Include the command in `git.c` in `commands[]` near the entry for `whatchanged`, + Include the command in `git.c` in `commands[]` near the entry for `version`, maintaining alphabetical ordering: ---- diff --cc Documentation/meson.build index 1433acfd31,594546d68b..2fe1a1369d --- a/Documentation/meson.build +++ b/Documentation/meson.build @@@ -158,7 -158,7 +158,6 @@@ manpages = 'git-verify-tag.adoc' : 1, 'git-version.adoc' : 1, 'git-web--browse.adoc' : 1, -- 'git-whatchanged.adoc' : 1, 'git-worktree.adoc' : 1, 'git-write-tree.adoc' : 1, 'git.adoc' : 1, @@@ -205,19 -205,11 +204,20 @@@ 'gitworkflows.adoc' : 7, } +manpages_breaking_changes = { + 'git-pack-redundant.adoc' : 1, ++ 'git-whatchanged.adoc' : 1, +} + +if not get_option('breaking_changes') + manpages += manpages_breaking_changes +endif + docs_backend = get_option('docs_backend') if docs_backend == 'auto' - if find_program('asciidoc', dirs: program_path, required: false).found() + if find_program('asciidoc', dirs: program_path, native: true, required: false).found() docs_backend = 'asciidoc' - elif find_program('asciidoctor', dirs: program_path, required: false).found() + elif find_program('asciidoctor', dirs: program_path, native: true, required: false).found() docs_backend = 'asciidoctor' else error('Neither asciidoc nor asciidoctor were found.') diff --cc t/t4013-diff-various.sh index 782d97fb7d,8e38df1685..8ebd170451 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@@ -206,14 -200,30 +206,30 @@@ d 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=WITHOUT_BREAKING_CHANGES ++ 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 -470,11 +476,11 @@@ diff-tree --stat --compact-summary init diff-tree -R --stat --compact-summary initial mode EOF -test_expect_success WITHOUT_BREAKING_CHANGES 'whatchanged needs --i-still-use-this' ' ++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 && diff --cc t/t4202-log.sh index 51f7beb59f,ad05f6772f..4a6c4dfbf4 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@@ -486,7 -486,12 +486,12 @@@ test_expect_success !FAIL_PREREQS 'log ) ' - for cmd in show whatchanged reflog format-patch + cmds="show reflog format-patch" -if test_have_prereq WITHOUT_BREAKING_CHANGES ++if test_have_prereq !WITH_BREAKING_CHANGES + then + cmds="$cmds whatchanged" + fi + for cmd in $cmds do case "$cmd" in format-patch) myarg="HEAD~.." ;; @@@ -1201,9 -1207,10 +1207,10 @@@ test_expect_success 'reflog is expecte test_cmp expect actual ' - test_expect_success 'whatchanged is expected format' ' -test_expect_success WITHOUT_BREAKING_CHANGES '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 ' @@@ -1213,8 -1222,12 +1222,12 @@@ test_expect_success 'log.abbrevCommit c 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 WITHOUT_BREAKING_CHANGES ++ 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 +1244,13 @@@ 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 WITHOUT_BREAKING_CHANGES ++ 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' '