Skip to content

Commit 07572f2

Browse files
committed
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 8ccc75c (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 <[email protected]>
1 parent 731a2c7 commit 07572f2

File tree

9 files changed

+66
-15
lines changed

9 files changed

+66
-15
lines changed

Documentation/config/format.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,15 @@ format.encodeEmailHeaders::
6868
Defaults to true.
6969

7070
format.pretty::
71+
ifndef::with-breaking-changes[]
7172
The default pretty format for log/show/whatchanged command.
7273
See linkgit:git-log[1], linkgit:git-show[1],
7374
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[]
7480

7581
format.thread::
7682
The default threading style for 'git format-patch'. Can be

Documentation/config/log.adoc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
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
411
override this option with `--no-abbrev-commit`.
512

613
log.date::

Documentation/pretty-options.adoc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,12 @@ ifndef::git-rev-list[]
6262
--notes[=<ref>]::
6363
Show the notes (see linkgit:git-notes[1]) that annotate the
6464
commit, when showing the commit log message. This is the default
65+
ifndef::with-breaking-changes[]
6566
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[]
6671
there is no `--pretty`, `--format`, or `--oneline` option given
6772
on the command line.
6873
+

Documentation/rev-list-options.adoc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,8 +1074,13 @@ Commit Formatting
10741074

10751075
ifdef::git-rev-list[]
10761076
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[]
10791084
endif::git-rev-list[]
10801085

10811086
include::pretty-options.adoc[]

Documentation/technical/sparse-checkout.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ understanding these differences can be beneficial.
442442
* blame (only matters when one or more -C flags are passed)
443443
* and annotate
444444
* log
445-
* whatchanged
445+
* whatchanged (may not exist anymore)
446446
* ls-files
447447
* diff-index
448448
* diff-tree

builtin/log.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,14 @@ struct log_config {
114114
char *fmt_pretty;
115115
char *default_date_mode;
116116

117+
#ifndef WITH_BREAKING_CHANGES
117118
/*
118119
* Note: git_log_config() does not touch this member and that
119120
* is very deliberate. This member is only to be used to
120121
* resurrect whatchanged that is deprecated.
121122
*/
122123
int i_still_use_this;
124+
#endif
123125
};
124126

125127
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,
274276
OPT__QUIET(&quiet, N_("suppress diff output")),
275277
OPT_BOOL(0, "source", &source, N_("show source")),
276278
OPT_BOOL(0, "use-mailmap", &mailmap, N_("use mail map file")),
279+
#ifndef WITH_BREAKING_CHANGES
277280
OPT_HIDDEN_BOOL(0, "i-still-use-this", &cfg->i_still_use_this,
278281
"<use this deprecated command>"),
282+
#endif
279283
OPT_ALIAS(0, "mailmap", "use-mailmap"),
280284
OPT_CALLBACK_F(0, "clear-decorations", NULL, NULL,
281285
N_("clear all previously-defined decoration filters"),
@@ -642,6 +646,7 @@ static int git_log_config(const char *var, const char *value,
642646
return git_diff_ui_config(var, value, ctx, cb);
643647
}
644648

649+
#ifndef WITH_BREAKING_CHANGES
645650
int cmd_whatchanged(int argc,
646651
const char **argv,
647652
const char *prefix,
@@ -678,6 +683,7 @@ int cmd_whatchanged(int argc,
678683
log_config_release(&cfg);
679684
return ret;
680685
}
686+
#endif
681687

682688
static void show_tagger(const char *buf, struct rev_info *rev)
683689
{

git.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,9 @@ static struct cmd_struct commands[] = {
645645
{ "verify-pack", cmd_verify_pack },
646646
{ "verify-tag", cmd_verify_tag, RUN_SETUP },
647647
{ "version", cmd_version },
648+
#ifndef WITH_BREAKING_CHANGES
648649
{ "whatchanged", cmd_whatchanged, RUN_SETUP },
650+
#endif
649651
{ "worktree", cmd_worktree, RUN_SETUP },
650652
{ "write-tree", cmd_write_tree, RUN_SETUP },
651653
};

t/t4013-diff-various.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,15 @@ do
200200
expect="$TEST_DIRECTORY/t4013/diff.$test"
201201
actual="$pfx-diff.$test"
202202

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)}" '
204212
{
205213
echo "$ git $cmd"
206214
@@ -462,7 +470,7 @@ diff-tree --stat --compact-summary initial mode
462470
diff-tree -R --stat --compact-summary initial mode
463471
EOF
464472

465-
test_expect_success 'whatchanged needs --i-still-use-this' '
473+
test_expect_success WITHOUT_BREAKING_CHANGES 'whatchanged needs --i-still-use-this' '
466474
test_must_fail git whatchanged >message 2>&1 &&
467475
test_grep "nominated for removal" message
468476
'

t/t4202-log.sh

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,12 @@ test_expect_success !FAIL_PREREQS 'log with various grep.patternType configurati
486486
)
487487
'
488488

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
490495
do
491496
case "$cmd" in
492497
format-patch) myarg="HEAD~.." ;;
@@ -1202,7 +1207,7 @@ test_expect_success 'reflog is expected format' '
12021207
test_cmp expect actual
12031208
'
12041209

1205-
test_expect_success 'whatchanged is expected format' '
1210+
test_expect_success WITHOUT_BREAKING_CHANGES 'whatchanged is expected format' '
12061211
whatchanged="whatchanged --i-still-use-this" &&
12071212
git log --no-merges --raw >expect &&
12081213
git $whatchanged >actual &&
@@ -1217,8 +1222,12 @@ test_expect_success 'log.abbrevCommit configuration' '
12171222
git log --pretty=raw >expect.log.raw &&
12181223
git reflog --abbrev-commit >expect.reflog.abbrev &&
12191224
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 &&
12221231
12231232
test_config log.abbrevCommit true &&
12241233
@@ -1235,10 +1244,13 @@ test_expect_success 'log.abbrevCommit configuration' '
12351244
git reflog --no-abbrev-commit >actual &&
12361245
test_cmp expect.reflog.full actual &&
12371246
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
12421254
'
12431255

12441256
test_expect_success '--abbrev-commit with core.abbrev=false' '

0 commit comments

Comments
 (0)