whatchanged: remove when built with WITH_BREAKING_CHANGES

As we made "git whatchanged" require "--i-still-use-this" and asked the users to report if they still want to use it, the logical next step is to allow us build Git without "whatchanged" to prepare for its eventual removal. If we were to follow the pattern established in 8ccc75c2 (remote: announce removal of "branches/" and "remotes/", 2025-01-22), we can do this together with the documentation update to officially list that the command will be removed in the BreakingChanges document, but let's just keep the changes separate just in case we want to proceed a bit slower. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed May 12, 2025 at 12:03 UTC 07572f220a83770f5b0b9717b29027e016fc99e4
9 files changed +66 -15
Documentation/config/format.adoc
+6
@@ -68,9 +68,15 @@ format.encodeEmailHeaders::
68 Defaults to true.
69
70 format.pretty::
71 +ifndef::with-breaking-changes[]
72 The default pretty format for log/show/whatchanged command.
73 See linkgit:git-log[1], linkgit:git-show[1],
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[]
80
81 format.thread::
82 The default threading style for 'git format-patch'. Can be
Documentation/config/log.adoc
+9 -2
@@ -1,6 +1,13 @@
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
11 override this option with `--no-abbrev-commit`.
12
13 log.date::
Documentation/pretty-options.adoc
+5
@@ -62,7 +62,12 @@ ifndef::git-rev-list[]
62 --notes[=<ref>]::
63 Show the notes (see linkgit:git-notes[1]) that annotate the
64 commit, when showing the commit log message. This is the default
65 +ifndef::with-breaking-changes[]
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[]
71 there is no `--pretty`, `--format`, or `--oneline` option given
72 on the command line.
73 +
Documentation/rev-list-options.adoc
+7 -2
@@ -1074,8 +1074,13 @@ Commit Formatting
1074
1075 ifdef::git-rev-list[]
1076 Using these options, linkgit:git-rev-list[1] will act similar to the
1077 -more specialized family of commit log tools: linkgit:git-log[1],
1078 -linkgit:git-show[1], and linkgit:git-whatchanged[1]
1077 +more specialized family of commit log tools:
1078 +ifndef::with-breaking-changes[]
1079 +linkgit:git-log[1], linkgit:git-show[1], and linkgit:git-whatchanged[1].
1080 +endif::with-breaking-changes[]
1081 +ifdef::with-breaking-changes[]
1082 +linkgit:git-log[1] and linkgit:git-show[1].
1083 +endif::with-breaking-changes[]
1084 endif::git-rev-list[]
1085
1086 include::pretty-options.adoc[]
Documentation/technical/sparse-checkout.adoc
+1 -1
@@ -442,7 +442,7 @@ understanding these differences can be beneficial.
442 * blame (only matters when one or more -C flags are passed)
443 * and annotate
444 * log
445 - * whatchanged
445 + * whatchanged (may not exist anymore)
446 * ls-files
447 * diff-index
448 * diff-tree
builtin/log.c
+6
@@ -114,12 +114,14 @@ struct log_config {
114 char *fmt_pretty;
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
125 };
126
127 static void log_config_init(struct log_config *cfg)
@@ -274,8 +276,10 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
276 OPT__QUIET(&quiet, N_("suppress diff output")),
277 OPT_BOOL(0, "source", &source, N_("show source")),
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
283 OPT_ALIAS(0, "mailmap", "use-mailmap"),
284 OPT_CALLBACK_F(0, "clear-decorations", NULL, NULL,
285 N_("clear all previously-defined decoration filters"),
@@ -642,6 +646,7 @@ static int git_log_config(const char *var, const char *value,
646 return git_diff_ui_config(var, value, ctx, cb);
647 }
648
649 +#ifndef WITH_BREAKING_CHANGES
650 int cmd_whatchanged(int argc,
651 const char **argv,
652 const char *prefix,
@@ -678,6 +683,7 @@ int cmd_whatchanged(int argc,
683 log_config_release(&cfg);
684 return ret;
685 }
686 +#endif
687
688 static void show_tagger(const char *buf, struct rev_info *rev)
689 {
git.c
+2
@@ -645,7 +645,9 @@ static struct cmd_struct commands[] = {
645 { "verify-pack", cmd_verify_pack },
646 { "verify-tag", cmd_verify_tag, RUN_SETUP },
647 { "version", cmd_version },
648 +#ifndef WITH_BREAKING_CHANGES
649 { "whatchanged", cmd_whatchanged, RUN_SETUP },
650 +#endif
651 { "worktree", cmd_worktree, RUN_SETUP },
652 { "write-tree", cmd_write_tree, RUN_SETUP },
653 };
t/t4013-diff-various.sh
+10 -2
@@ -200,7 +200,15 @@ do
200 expect="$TEST_DIRECTORY/t4013/diff.$test"
201 actual="$pfx-diff.$test"
202
203 - test_expect_success "git $cmd # magic is ${magic:-(not used)}" '
203 + case "$cmd" in
204 + whatchanged | whatchanged" "*)
205 + prereq=WITHOUT_BREAKING_CHANGES
206 + ;;
207 + *)
208 + prereq=;;
209 + esac
210 +
211 + test_expect_success $prereq "git $cmd # magic is ${magic:-(not used)}" '
212 {
213 echo "$ git $cmd"
214
@@ -462,7 +470,7 @@ diff-tree --stat --compact-summary initial mode
470 diff-tree -R --stat --compact-summary initial mode
471 EOF
472
465 -test_expect_success 'whatchanged needs --i-still-use-this' '
473 +test_expect_success WITHOUT_BREAKING_CHANGES 'whatchanged needs --i-still-use-this' '
474 test_must_fail git whatchanged >message 2>&1 &&
475 test_grep "nominated for removal" message
476 '
t/t4202-log.sh
+20 -8
@@ -486,7 +486,12 @@ test_expect_success !FAIL_PREREQS 'log with various grep.patternType configurati
486 )
487 '
488
489 -for cmd in show whatchanged reflog format-patch
489 +cmds="show reflog format-patch"
490 +if test_have_prereq WITHOUT_BREAKING_CHANGES
491 +then
492 + cmds="$cmds whatchanged"
493 +fi
494 +for cmd in $cmds
495 do
496 case "$cmd" in
497 format-patch) myarg="HEAD~.." ;;
@@ -1202,7 +1207,7 @@ test_expect_success 'reflog is expected format' '
1207 test_cmp expect actual
1208 '
1209
1205 -test_expect_success 'whatchanged is expected format' '
1210 +test_expect_success WITHOUT_BREAKING_CHANGES 'whatchanged is expected format' '
1211 whatchanged="whatchanged --i-still-use-this" &&
1212 git log --no-merges --raw >expect &&
1213 git $whatchanged >actual &&
@@ -1217,8 +1222,12 @@ test_expect_success 'log.abbrevCommit configuration' '
1222 git log --pretty=raw >expect.log.raw &&
1223 git reflog --abbrev-commit >expect.reflog.abbrev &&
1224 git reflog --no-abbrev-commit >expect.reflog.full &&
1220 - git $whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
1221 - git $whatchanged --no-abbrev-commit >expect.whatchanged.full &&
1225 +
1226 + if test_have_prereq WITHOUT_BREAKING_CHANGES
1227 + then
1228 + git $whatchanged --abbrev-commit >expect.whatchanged.abbrev &&
1229 + git $whatchanged --no-abbrev-commit >expect.whatchanged.full
1230 + fi &&
1231
1232 test_config log.abbrevCommit true &&
1233
@@ -1235,10 +1244,13 @@ test_expect_success 'log.abbrevCommit configuration' '
1244 git reflog --no-abbrev-commit >actual &&
1245 test_cmp expect.reflog.full actual &&
1246
1238 - git $whatchanged >actual &&
1239 - test_cmp expect.whatchanged.abbrev actual &&
1240 - git $whatchanged --no-abbrev-commit >actual &&
1241 - test_cmp expect.whatchanged.full actual
1247 + if test_have_prereq WITHOUT_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
1254 '
1255
1256 test_expect_success '--abbrev-commit with core.abbrev=false' '