Skip to content

Commit a5cc6a2

Browse files
committed
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
2 parents f0135a9 + e836757 commit a5cc6a2

21 files changed

+152
-39
lines changed

Documentation/BreakingChanges.adoc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,14 @@ These features will be removed.
183183
timeframe, in preference to its synonym "--annotate-stdin". Git 3.0
184184
removes the support for "--stdin" altogether.
185185

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.
186194

187195
== Superseded features that will not be deprecated
188196

Documentation/Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,12 @@ lint-docs-meson:
510510
awk "/^manpages = {$$/ {flag=1 ; next } /^}$$/ { flag=0 } flag { gsub(/^ \047/, \"\"); gsub(/\047 : [157],\$$/, \"\"); print }" meson.build | \
511511
grep -v -e '#' -e '^$$' | \
512512
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 && \
514519
if ! cmp tmp-meson-diff/meson.adoc tmp-meson-diff/actual.adoc; then \
515520
echo "Meson man pages differ from actual man pages:"; \
516521
diff -u tmp-meson-diff/meson.adoc tmp-meson-diff/actual.adoc; \

Documentation/MyFirstObjectWalk.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ int cmd_walken(int argc, const char **argv, const char *prefix)
8383
}
8484
----
8585

86-
Also add the relevant line in `builtin.h` near `cmd_whatchanged()`:
86+
Also add the relevant line in `builtin.h` near `cmd_version()`:
8787

8888
----
8989
int cmd_walken(int argc, const char **argv, const char *prefix, struct repository *repo);
9090
----
9191

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`,
9393
maintaining alphabetical ordering:
9494

9595
----

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/git-whatchanged.adoc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@ git-whatchanged - Show logs with differences each commit introduces
88

99
SYNOPSIS
1010
--------
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`.
1319

1420
DESCRIPTION
1521
-----------

Documentation/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,6 @@ manpages = {
158158
'git-verify-tag.adoc' : 1,
159159
'git-version.adoc' : 1,
160160
'git-web--browse.adoc' : 1,
161-
'git-whatchanged.adoc' : 1,
162161
'git-worktree.adoc' : 1,
163162
'git-write-tree.adoc' : 1,
164163
'git.adoc' : 1,
@@ -207,6 +206,7 @@ manpages = {
207206

208207
manpages_breaking_changes = {
209208
'git-pack-redundant.adoc' : 1,
209+
'git-whatchanged.adoc' : 1,
210210
}
211211

212212
if not get_option('breaking_changes')

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
@@ -1100,8 +1100,13 @@ Commit Formatting
11001100

11011101
ifdef::git-rev-list[]
11021102
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[]
11051110
endif::git-rev-list[]
11061111

11071112
include::pretty-options.adoc[]

Documentation/technical/sparse-checkout.adoc

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

Documentation/user-manual.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4240,7 +4240,7 @@ command `git`. The source side of a builtin is
42404240
- an entry in `BUILTIN_OBJECTS` in the `Makefile`.
42414241

42424242
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`,
42444244
since they share quite a bit of code. In that case, the commands which are
42454245
_not_ named like the `.c` file in which they live have to be listed in
42464246
`BUILT_INS` in the `Makefile`.

builtin/log.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,15 @@ struct log_config {
113113
int fmt_patch_name_max;
114114
char *fmt_pretty;
115115
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
116125
};
117126

118127
static void log_config_init(struct log_config *cfg)
@@ -267,6 +276,10 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix,
267276
OPT__QUIET(&quiet, N_("suppress diff output")),
268277
OPT_BOOL(0, "source", &source, N_("show source")),
269278
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
270283
OPT_ALIAS(0, "mailmap", "use-mailmap"),
271284
OPT_CALLBACK_F(0, "clear-decorations", NULL, NULL,
272285
N_("clear all previously-defined decoration filters"),
@@ -633,6 +646,7 @@ static int git_log_config(const char *var, const char *value,
633646
return git_diff_ui_config(var, value, ctx, cb);
634647
}
635648

649+
#ifndef WITH_BREAKING_CHANGES
636650
int cmd_whatchanged(int argc,
637651
const char **argv,
638652
const char *prefix,
@@ -656,6 +670,10 @@ int cmd_whatchanged(int argc,
656670
opt.def = "HEAD";
657671
opt.revarg_opt = REVARG_COMMITTISH;
658672
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+
659677
if (!rev.diffopt.output_format)
660678
rev.diffopt.output_format = DIFF_FORMAT_RAW;
661679

@@ -665,6 +683,7 @@ int cmd_whatchanged(int argc,
665683
log_config_release(&cfg);
666684
return ret;
667685
}
686+
#endif
668687

669688
static void show_tagger(const char *buf, struct rev_info *rev)
670689
{

builtin/pack-redundant.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -625,14 +625,8 @@ int cmd_pack_redundant(int argc, const char **argv, const char *prefix UNUSED, s
625625
break;
626626
}
627627

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 <[email protected]>. 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");
636630

637631
if (load_all_packs)
638632
load_all();

git-compat-util.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,8 @@ void warning_errno(const char *err, ...) __attribute__((format (printf, 1, 2)));
460460

461461
void show_usage_if_asked(int ac, const char **av, const char *err);
462462

463+
NORETURN void you_still_use_that(const char *command_name);
464+
463465
#ifndef NO_OPENSSL
464466
#ifdef APPLE_COMMON_CRYPTO
465467
#include "compat/apple-common-crypto.h"

git.c

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

t/t4013-diff-various.sh

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,30 @@ do
206206
expect="$TEST_DIRECTORY/t4013/diff.$test"
207207
actual="$pfx-diff.$test"
208208

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)}" '
210218
{
211219
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 &&
212228
case "$magic" in
213229
"")
214-
GIT_PRINT_SHA1_ELLIPSIS=yes git $cmd ;;
230+
GIT_PRINT_SHA1_ELLIPSIS=yes git $run ;;
215231
noellipses)
216-
git $cmd ;;
232+
git $run ;;
217233
esac |
218234
sed -e "s/^\\(-*\\)$V\\(-*\\)\$/\\1g-i-t--v-e-r-s-i-o-n\2/" \
219235
-e "s/^\\(.*mixed; boundary=\"-*\\)$V\\(-*\\)\"\$/\\1g-i-t--v-e-r-s-i-o-n\2\"/"
@@ -460,6 +476,11 @@ diff-tree --stat --compact-summary initial mode
460476
diff-tree -R --stat --compact-summary initial mode
461477
EOF
462478

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+
'
483+
463484
test_expect_success 'log -m matches pure log' '
464485
git log master >result &&
465486
process_diffs result >expected &&

t/t4202-log.sh

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -486,10 +486,16 @@ 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 !WITH_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~.." ;;
498+
whatchanged) myarg=--i-still-use-this ;;
493499
*) myarg= ;;
494500
esac
495501

@@ -1201,20 +1207,27 @@ test_expect_success 'reflog is expected format' '
12011207
test_cmp expect actual
12021208
'
12031209

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" &&
12051212
git log --no-merges --raw >expect &&
1206-
git whatchanged >actual &&
1213+
git $whatchanged >actual &&
12071214
test_cmp expect actual
12081215
'
12091216

12101217
test_expect_success 'log.abbrevCommit configuration' '
1218+
whatchanged="whatchanged --i-still-use-this" &&
1219+
12111220
git log --abbrev-commit >expect.log.abbrev &&
12121221
git log --no-abbrev-commit >expect.log.full &&
12131222
git log --pretty=raw >expect.log.raw &&
12141223
git reflog --abbrev-commit >expect.reflog.abbrev &&
12151224
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 &&
12181231
12191232
test_config log.abbrevCommit true &&
12201233
@@ -1231,10 +1244,13 @@ test_expect_success 'log.abbrevCommit configuration' '
12311244
git reflog --no-abbrev-commit >actual &&
12321245
test_cmp expect.reflog.full actual &&
12331246
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
12381254
'
12391255

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

t/t5323-pack-redundant.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ fi
4545
main_repo=main.git
4646
shared_repo=shared.git
4747

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+
4853
git_pack_redundant='git pack-redundant --i-still-use-this'
4954

5055
# Create commits in <repo> and assign each commit's oid to shell variables

0 commit comments

Comments
 (0)