Git fork

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

+152 -39
+8
Documentation/BreakingChanges.adoc
··· 183 183 timeframe, in preference to its synonym "--annotate-stdin". Git 3.0 184 184 removes the support for "--stdin" altogether. 185 185 186 + * The git-whatchanged(1) command has outlived its usefulness more than 187 + 10 years ago, and takes more keystrokes to type than its rough 188 + equivalent `git log --raw`. We have nominated the command for 189 + removal, have changed the command to refuse to work unless the 190 + `--i-still-use-this` option is given, and asked the users to report 191 + when they do so. So far there hasn't been a single complaint. 192 + + 193 + The command will be removed. 186 194 187 195 == Superseded features that will not be deprecated 188 196
+6 -1
Documentation/Makefile
··· 510 510 awk "/^manpages = {$$/ {flag=1 ; next } /^}$$/ { flag=0 } flag { gsub(/^ \047/, \"\"); gsub(/\047 : [157],\$$/, \"\"); print }" meson.build | \ 511 511 grep -v -e '#' -e '^$$' | \ 512 512 sort >tmp-meson-diff/meson.adoc && \ 513 - 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 && \ 513 + ls git*.adoc scalar.adoc | \ 514 + grep -v -e git-bisect-lk2009.adoc \ 515 + -e git-pack-redundant.adoc \ 516 + -e git-tools.adoc \ 517 + -e git-whatchanged.adoc \ 518 + >tmp-meson-diff/actual.adoc && \ 514 519 if ! cmp tmp-meson-diff/meson.adoc tmp-meson-diff/actual.adoc; then \ 515 520 echo "Meson man pages differ from actual man pages:"; \ 516 521 diff -u tmp-meson-diff/meson.adoc tmp-meson-diff/actual.adoc; \
+2 -2
Documentation/MyFirstObjectWalk.adoc
··· 83 83 } 84 84 ---- 85 85 86 - Also add the relevant line in `builtin.h` near `cmd_whatchanged()`: 86 + Also add the relevant line in `builtin.h` near `cmd_version()`: 87 87 88 88 ---- 89 89 int cmd_walken(int argc, const char **argv, const char *prefix, struct repository *repo); 90 90 ---- 91 91 92 - Include the command in `git.c` in `commands[]` near the entry for `whatchanged`, 92 + Include the command in `git.c` in `commands[]` near the entry for `version`, 93 93 maintaining alphabetical ordering: 94 94 95 95 ----
+6
Documentation/config/format.adoc
··· 68 68 Defaults to true. 69 69 70 70 format.pretty:: 71 + ifndef::with-breaking-changes[] 71 72 The default pretty format for log/show/whatchanged command. 72 73 See linkgit:git-log[1], linkgit:git-show[1], 73 74 linkgit:git-whatchanged[1]. 75 + endif::with-breaking-changes[] 76 + ifdef::with-breaking-changes[] 77 + The default pretty format for log/show command. 78 + See linkgit:git-log[1], linkgit:git-show[1]. 79 + endif::with-breaking-changes[] 74 80 75 81 format.thread:: 76 82 The default threading style for 'git format-patch'. Can be
+9 -2
Documentation/config/log.adoc
··· 1 1 log.abbrevCommit:: 2 - If true, makes linkgit:git-log[1], linkgit:git-show[1], and 3 - linkgit:git-whatchanged[1] assume `--abbrev-commit`. You may 2 + If true, makes 3 + ifndef::with-breaking-changes[] 4 + linkgit:git-log[1], linkgit:git-show[1], and 5 + linkgit:git-whatchanged[1] 6 + endif::with-breaking-changes[] 7 + ifdef::with-breaking-changes[] 8 + linkgit:git-log[1] and linkgit:git-show[1] 9 + endif::with-breaking-changes[] 10 + assume `--abbrev-commit`. You may 4 11 override this option with `--no-abbrev-commit`. 5 12 6 13 log.date::
+8 -2
Documentation/git-whatchanged.adoc
··· 8 8 9 9 SYNOPSIS 10 10 -------- 11 - [verse] 12 - 'git whatchanged' <option>... 11 + [synopsis] 12 + git whatchanged <option>... 13 + 14 + WARNING 15 + ------- 16 + `git whatchanged` has been deprecated and is scheduled for removal in 17 + a future version of Git, as it is merely `git log` with different 18 + default; `whatchanged` is not even shorter to type than `log --raw`. 13 19 14 20 DESCRIPTION 15 21 -----------
+1 -1
Documentation/meson.build
··· 158 158 'git-verify-tag.adoc' : 1, 159 159 'git-version.adoc' : 1, 160 160 'git-web--browse.adoc' : 1, 161 - 'git-whatchanged.adoc' : 1, 162 161 'git-worktree.adoc' : 1, 163 162 'git-write-tree.adoc' : 1, 164 163 'git.adoc' : 1, ··· 207 206 208 207 manpages_breaking_changes = { 209 208 'git-pack-redundant.adoc' : 1, 209 + 'git-whatchanged.adoc' : 1, 210 210 } 211 211 212 212 if not get_option('breaking_changes')
+5
Documentation/pretty-options.adoc
··· 62 62 --notes[=<ref>]:: 63 63 Show the notes (see linkgit:git-notes[1]) that annotate the 64 64 commit, when showing the commit log message. This is the default 65 + ifndef::with-breaking-changes[] 65 66 for `git log`, `git show` and `git whatchanged` commands when 67 + endif::with-breaking-changes[] 68 + ifdef::with-breaking-changes[] 69 + for `git log` and `git show` commands when 70 + endif::with-breaking-changes[] 66 71 there is no `--pretty`, `--format`, or `--oneline` option given 67 72 on the command line. 68 73 +
+7 -2
Documentation/rev-list-options.adoc
··· 1100 1100 1101 1101 ifdef::git-rev-list[] 1102 1102 Using these options, linkgit:git-rev-list[1] will act similar to the 1103 - more specialized family of commit log tools: linkgit:git-log[1], 1104 - linkgit:git-show[1], and linkgit:git-whatchanged[1] 1103 + more specialized family of commit log tools: 1104 + ifndef::with-breaking-changes[] 1105 + linkgit:git-log[1], linkgit:git-show[1], and linkgit:git-whatchanged[1]. 1106 + endif::with-breaking-changes[] 1107 + ifdef::with-breaking-changes[] 1108 + linkgit:git-log[1] and linkgit:git-show[1]. 1109 + endif::with-breaking-changes[] 1105 1110 endif::git-rev-list[] 1106 1111 1107 1112 include::pretty-options.adoc[]
+1 -1
Documentation/technical/sparse-checkout.adoc
··· 440 440 * blame (only matters when one or more -C flags are passed) 441 441 * and annotate 442 442 * log 443 - * whatchanged 443 + * whatchanged (may not exist anymore) 444 444 * ls-files 445 445 * diff-index 446 446 * diff-tree
+1 -1
Documentation/user-manual.adoc
··· 4240 4240 - an entry in `BUILTIN_OBJECTS` in the `Makefile`. 4241 4241 4242 4242 Sometimes, more than one builtin is contained in one source file. For 4243 - example, `cmd_whatchanged()` and `cmd_log()` both reside in `builtin/log.c`, 4243 + example, `cmd_show()` and `cmd_log()` both reside in `builtin/log.c`, 4244 4244 since they share quite a bit of code. In that case, the commands which are 4245 4245 _not_ named like the `.c` file in which they live have to be listed in 4246 4246 `BUILT_INS` in the `Makefile`.
+19
builtin/log.c
··· 113 113 int fmt_patch_name_max; 114 114 char *fmt_pretty; 115 115 char *default_date_mode; 116 + 117 + #ifndef WITH_BREAKING_CHANGES 118 + /* 119 + * Note: git_log_config() does not touch this member and that 120 + * is very deliberate. This member is only to be used to 121 + * resurrect whatchanged that is deprecated. 122 + */ 123 + int i_still_use_this; 124 + #endif 116 125 }; 117 126 118 127 static void log_config_init(struct log_config *cfg) ··· 267 276 OPT__QUIET(&quiet, N_("suppress diff output")), 268 277 OPT_BOOL(0, "source", &source, N_("show source")), 269 278 OPT_BOOL(0, "use-mailmap", &mailmap, N_("use mail map file")), 279 + #ifndef WITH_BREAKING_CHANGES 280 + OPT_HIDDEN_BOOL(0, "i-still-use-this", &cfg->i_still_use_this, 281 + "<use this deprecated command>"), 282 + #endif 270 283 OPT_ALIAS(0, "mailmap", "use-mailmap"), 271 284 OPT_CALLBACK_F(0, "clear-decorations", NULL, NULL, 272 285 N_("clear all previously-defined decoration filters"), ··· 633 646 return git_diff_ui_config(var, value, ctx, cb); 634 647 } 635 648 649 + #ifndef WITH_BREAKING_CHANGES 636 650 int cmd_whatchanged(int argc, 637 651 const char **argv, 638 652 const char *prefix, ··· 656 670 opt.def = "HEAD"; 657 671 opt.revarg_opt = REVARG_COMMITTISH; 658 672 cmd_log_init(argc, argv, prefix, &rev, &opt, &cfg); 673 + 674 + if (!cfg.i_still_use_this) 675 + you_still_use_that("git whatchanged"); 676 + 659 677 if (!rev.diffopt.output_format) 660 678 rev.diffopt.output_format = DIFF_FORMAT_RAW; 661 679 ··· 665 683 log_config_release(&cfg); 666 684 return ret; 667 685 } 686 + #endif 668 687 669 688 static void show_tagger(const char *buf, struct rev_info *rev) 670 689 {
+2 -8
builtin/pack-redundant.c
··· 625 625 break; 626 626 } 627 627 628 - if (!i_still_use_this) { 629 - fputs(_("'git pack-redundant' is nominated for removal.\n" 630 - "If you still use this command, please add an extra\n" 631 - "option, '--i-still-use-this', on the command line\n" 632 - "and let us know you still use it by sending an e-mail\n" 633 - "to <git@vger.kernel.org>. Thanks.\n"), stderr); 634 - die(_("refusing to run without --i-still-use-this")); 635 - } 628 + if (!i_still_use_this) 629 + you_still_use_that("git pack-redundant"); 636 630 637 631 if (load_all_packs) 638 632 load_all();
+2
git-compat-util.h
··· 460 460 461 461 void show_usage_if_asked(int ac, const char **av, const char *err); 462 462 463 + NORETURN void you_still_use_that(const char *command_name); 464 + 463 465 #ifndef NO_OPENSSL 464 466 #ifdef APPLE_COMMON_CRYPTO 465 467 #include "compat/apple-common-crypto.h"
+2
git.c
··· 646 646 { "verify-pack", cmd_verify_pack }, 647 647 { "verify-tag", cmd_verify_tag, RUN_SETUP }, 648 648 { "version", cmd_version }, 649 + #ifndef WITH_BREAKING_CHANGES 649 650 { "whatchanged", cmd_whatchanged, RUN_SETUP }, 651 + #endif 650 652 { "worktree", cmd_worktree, RUN_SETUP }, 651 653 { "write-tree", cmd_write_tree, RUN_SETUP }, 652 654 };
+24 -3
t/t4013-diff-various.sh
··· 206 206 expect="$TEST_DIRECTORY/t4013/diff.$test" 207 207 actual="$pfx-diff.$test" 208 208 209 - test_expect_success "git $cmd # magic is ${magic:-(not used)}" ' 209 + case "$cmd" in 210 + whatchanged | whatchanged" "*) 211 + prereq=!WITH_BREAKING_CHANGES 212 + ;; 213 + *) 214 + prereq=;; 215 + esac 216 + 217 + test_expect_success $prereq "git $cmd # magic is ${magic:-(not used)}" ' 210 218 { 211 219 echo "$ git $cmd" 220 + 221 + case "$cmd" in 222 + whatchanged | whatchanged" "*) 223 + run="whatchanged --i-still-use-this" 224 + run="$run ${cmd#whatchanged}" ;; 225 + *) 226 + run=$cmd ;; 227 + esac && 212 228 case "$magic" in 213 229 "") 214 - GIT_PRINT_SHA1_ELLIPSIS=yes git $cmd ;; 230 + GIT_PRINT_SHA1_ELLIPSIS=yes git $run ;; 215 231 noellipses) 216 - git $cmd ;; 232 + git $run ;; 217 233 esac | 218 234 sed -e "s/^\\(-*\\)$V\\(-*\\)\$/\\1g-i-t--v-e-r-s-i-o-n\2/" \ 219 235 -e "s/^\\(.*mixed; boundary=\"-*\\)$V\\(-*\\)\"\$/\\1g-i-t--v-e-r-s-i-o-n\2\"/" ··· 459 475 diff-tree --stat --compact-summary initial mode 460 476 diff-tree -R --stat --compact-summary initial mode 461 477 EOF 478 + 479 + test_expect_success !WITH_BREAKING_CHANGES 'whatchanged needs --i-still-use-this' ' 480 + test_must_fail git whatchanged >message 2>&1 && 481 + test_grep "nominated for removal" message 482 + ' 462 483 463 484 test_expect_success 'log -m matches pure log' ' 464 485 git log master >result &&
+25 -9
t/t4202-log.sh
··· 486 486 ) 487 487 ' 488 488 489 - for cmd in show whatchanged reflog format-patch 489 + cmds="show reflog format-patch" 490 + if test_have_prereq !WITH_BREAKING_CHANGES 491 + then 492 + cmds="$cmds whatchanged" 493 + fi 494 + for cmd in $cmds 490 495 do 491 496 case "$cmd" in 492 497 format-patch) myarg="HEAD~.." ;; 498 + whatchanged) myarg=--i-still-use-this ;; 493 499 *) myarg= ;; 494 500 esac 495 501 ··· 1201 1207 test_cmp expect actual 1202 1208 ' 1203 1209 1204 - test_expect_success 'whatchanged is expected format' ' 1210 + test_expect_success !WITH_BREAKING_CHANGES 'whatchanged is expected format' ' 1211 + whatchanged="whatchanged --i-still-use-this" && 1205 1212 git log --no-merges --raw >expect && 1206 - git whatchanged >actual && 1213 + git $whatchanged >actual && 1207 1214 test_cmp expect actual 1208 1215 ' 1209 1216 1210 1217 test_expect_success 'log.abbrevCommit configuration' ' 1218 + whatchanged="whatchanged --i-still-use-this" && 1219 + 1211 1220 git log --abbrev-commit >expect.log.abbrev && 1212 1221 git log --no-abbrev-commit >expect.log.full && 1213 1222 git log --pretty=raw >expect.log.raw && 1214 1223 git reflog --abbrev-commit >expect.reflog.abbrev && 1215 1224 git reflog --no-abbrev-commit >expect.reflog.full && 1216 - git whatchanged --abbrev-commit >expect.whatchanged.abbrev && 1217 - git whatchanged --no-abbrev-commit >expect.whatchanged.full && 1225 + 1226 + if test_have_prereq !WITH_BREAKING_CHANGES 1227 + then 1228 + git $whatchanged --abbrev-commit >expect.whatchanged.abbrev && 1229 + git $whatchanged --no-abbrev-commit >expect.whatchanged.full 1230 + fi && 1218 1231 1219 1232 test_config log.abbrevCommit true && 1220 1233 ··· 1231 1244 git reflog --no-abbrev-commit >actual && 1232 1245 test_cmp expect.reflog.full actual && 1233 1246 1234 - git whatchanged >actual && 1235 - test_cmp expect.whatchanged.abbrev actual && 1236 - git whatchanged --no-abbrev-commit >actual && 1237 - test_cmp expect.whatchanged.full actual 1247 + if test_have_prereq !WITH_BREAKING_CHANGES 1248 + then 1249 + git $whatchanged >actual && 1250 + test_cmp expect.whatchanged.abbrev actual && 1251 + git $whatchanged --no-abbrev-commit >actual && 1252 + test_cmp expect.whatchanged.full actual 1253 + fi 1238 1254 ' 1239 1255 1240 1256 test_expect_success '--abbrev-commit with core.abbrev=false' '
+5
t/t5323-pack-redundant.sh
··· 45 45 main_repo=main.git 46 46 shared_repo=shared.git 47 47 48 + test_expect_success 'pack-redundant needs --i-still-use-this' ' 49 + test_must_fail git pack-redundant >message 2>&1 && 50 + test_grep "nominated for removal" message 51 + ' 52 + 48 53 git_pack_redundant='git pack-redundant --i-still-use-this' 49 54 50 55 # Create commits in <repo> and assign each commit's oid to shell variables
+6 -6
t/t9300-fast-import.sh
··· 120 120 121 121 INPUT_END 122 122 git fast-import --export-marks=marks.out <input && 123 - git whatchanged main 123 + git log --raw main 124 124 ' 125 125 126 126 test_expect_success 'A: verify pack' ' ··· 279 279 INPUT_END 280 280 281 281 git fast-import --import-marks=marks.out <input && 282 - git whatchanged verify--import-marks 282 + git log --raw verify--import-marks 283 283 ' 284 284 285 285 test_expect_success 'A: verify pack' ' ··· 652 652 INPUT_END 653 653 654 654 git fast-import <input && 655 - git whatchanged branch 655 + git log --raw branch 656 656 ' 657 657 658 658 test_expect_success 'C: verify pack' ' ··· 715 715 INPUT_END 716 716 717 717 git fast-import <input && 718 - git whatchanged branch 718 + git log --raw branch 719 719 ' 720 720 721 721 test_expect_success 'D: verify pack' ' ··· 882 882 883 883 INPUT_END 884 884 git fast-import <input && 885 - git whatchanged H 885 + git log --raw H 886 886 ' 887 887 888 888 test_expect_success 'H: verify pack' ' ··· 2066 2066 INPUT_END 2067 2067 2068 2068 git fast-import <input && 2069 - git whatchanged notes-test 2069 + git log --raw notes-test 2070 2070 ' 2071 2071 2072 2072 test_expect_success 'Q: verify pack' '
+1 -1
t/t9301-fast-import-notes.sh
··· 76 76 test_expect_success 'set up main branch' ' 77 77 78 78 git fast-import <input && 79 - git whatchanged main 79 + git log --raw main 80 80 ' 81 81 82 82 commit4=$(git rev-parse refs/heads/main)
+12
usage.c
··· 372 372 trace2_cmd_error_va(fmt, ap); 373 373 va_end(ap); 374 374 } 375 + 376 + NORETURN void you_still_use_that(const char *command_name) 377 + { 378 + fprintf(stderr, 379 + _("'%s' is nominated for removal.\n" 380 + "If you still use this command, please add an extra\n" 381 + "option, '--i-still-use-this', on the command line\n" 382 + "and let us know you still use it by sending an e-mail\n" 383 + "to <git@vger.kernel.org>. Thanks.\n"), 384 + command_name); 385 + die(_("refusing to run without --i-still-use-this")); 386 + }