]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jc/you-still-use-whatchanged'
authorJunio C Hamano <gitster@pobox.com>
Wed, 25 Jun 2025 21:07:35 +0000 (14:07 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 25 Jun 2025 21:07:35 +0000 (14:07 -0700)
"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

13 files changed:
1  2 
Documentation/BreakingChanges.adoc
Documentation/Makefile
Documentation/MyFirstObjectWalk.adoc
Documentation/meson.build
Documentation/rev-list-options.adoc
Documentation/technical/sparse-checkout.adoc
builtin/log.c
builtin/pack-redundant.c
git-compat-util.h
git.c
t/t4013-diff-various.sh
t/t4202-log.sh
t/t5323-pack-redundant.sh

index 61bdd586b9edb2314c26998a8c8e840cd549aaaf,ac9a84c17b88e09bb6286fa9365d4c37a5d138f4..c6bd94986c5fccf1696def8dff232354b63e27a7
@@@ -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
  
index b109d25e9c804d56511da0439e116a9c17e45ee7,671267a8ac7af6c298af716b4be1a0b4900be396..df2ce187eb84cf6ca43fa1229789058155931347
@@@ -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; \
index b7b2adc5defc0ba56deccd5b250c2c52cbd57a4b,102a465a48a8879ffec2708e97b211538b484842..413a9fdb05c56eae2926d58035f7334393c87c0a
@@@ -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:
  
  ----
index 1433acfd310e7b1567bd3d9180467bc5fee58511,594546d68b12c1a72efd6e1cdf84ad9006ad5eba..2fe1a1369d444d273f3d05c73a23c513665ed30b
@@@ -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,
    '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.')
Simple merge
diff --cc builtin/log.c
Simple merge
Simple merge
Simple merge
diff --cc git.c
Simple merge
index 782d97fb7df2694d1a8a07765571f0b8e3a6bfa6,8e38df16858d4ae70fc37158a323b943bd9f18c0..8ebd170451d02516ecb005eefc7df9882e150483
        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 51f7beb59f88c8fba384acf7c4772e255b612dbf,ad05f6772f7371f091518864edf2cf046f8b9cf3..4a6c4dfbf4d62de9a321d61c1558a05161aa4cf0
@@@ -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 &&
  
        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' '
Simple merge