Skip to content

Commit a8e602f

Browse files
committed
Merge branch 'kh/you-still-use-whatchanged-fix' into jch
Update "do you still use it?" message given by a command that is deeply deprecated and allow us to suggest alternatives. * kh/you-still-use-whatchanged-fix: BreakingChanges: remove claim about whatchanged reports whatchanged: remove not-even-shorter clause whatchanged: tell users the git-log(1) equivalent you-still-use-that??: help the user help themselves
2 parents 356602b + fa84ab8 commit a8e602f

6 files changed

Lines changed: 40 additions & 13 deletions

File tree

Documentation/BreakingChanges.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ These features will be removed.
235235
equivalent `git log --raw`. We have nominated the command for
236236
removal, have changed the command to refuse to work unless the
237237
`--i-still-use-this` option is given, and asked the users to report
238-
when they do so. So far there hasn't been a single complaint.
238+
when they do so.
239239
+
240240
The command will be removed.
241241

Documentation/git-whatchanged.adoc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ WARNING
1515
-------
1616
`git whatchanged` has been deprecated and is scheduled for removal in
1717
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`.
18+
defaults.
1919

2020
DESCRIPTION
2121
-----------
@@ -24,7 +24,11 @@ Shows commit logs and diff output each commit introduces.
2424

2525
New users are encouraged to use linkgit:git-log[1] instead. The
2626
`whatchanged` command is essentially the same as linkgit:git-log[1]
27-
but defaults to showing the raw format diff output and skipping merges.
27+
but defaults to showing the raw format diff output and skipping merges:
28+
29+
----
30+
git log --raw --no-merges
31+
----
2832

2933
The command is primarily kept for historical reasons; fingers of
3034
many people who learned Git long before `git log` was invented by

builtin/log.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,11 @@ int cmd_whatchanged(int argc,
543543
cmd_log_init(argc, argv, prefix, &rev, &opt, &cfg);
544544

545545
if (!cfg.i_still_use_this)
546-
you_still_use_that("git whatchanged");
546+
you_still_use_that("git whatchanged",
547+
_("\n"
548+
"hint: You can replace 'git whatchanged <opts>' with:\n"
549+
" git log <opts> --raw --no-merges\n"
550+
"\n"));
547551

548552
if (!rev.diffopt.output_format)
549553
rev.diffopt.output_format = DIFF_FORMAT_RAW;

builtin/pack-redundant.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ int cmd_pack_redundant(int argc, const char **argv, const char *prefix UNUSED, s
626626
}
627627

628628
if (!i_still_use_this)
629-
you_still_use_that("git pack-redundant");
629+
you_still_use_that("git pack-redundant", NULL);
630630

631631
if (load_all_packs)
632632
load_all();

git-compat-util.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ 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);
463+
NORETURN void you_still_use_that(const char *command_name, const char *hint);
464464

465465
#ifndef NO_OPENSSL
466466
#ifdef APPLE_COMMON_CRYPTO

usage.c

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "git-compat-util.h"
88
#include "gettext.h"
99
#include "trace2.h"
10+
#include "strbuf.h"
1011

1112
static void vfreportf(FILE *f, const char *prefix, const char *err, va_list params)
1213
{
@@ -376,14 +377,32 @@ void bug_fl(const char *file, int line, const char *fmt, ...)
376377
va_end(ap);
377378
}
378379

379-
NORETURN void you_still_use_that(const char *command_name)
380+
381+
NORETURN void you_still_use_that(const char *command_name, const char *hint)
380382
{
383+
struct strbuf percent_encoded = STRBUF_INIT;
384+
strbuf_add_percentencode(&percent_encoded,
385+
command_name,
386+
STRBUF_ENCODE_SLASH);
387+
388+
fprintf(stderr,
389+
_("'%s' is nominated for removal.\n"), command_name);
390+
391+
if (hint)
392+
fputs(hint, stderr);
393+
381394
fprintf(stderr,
382-
_("'%s' is nominated for removal.\n"
383-
"If you still use this command, please add an extra\n"
384-
"option, '--i-still-use-this', on the command line\n"
385-
"and let us know you still use it by sending an e-mail\n"
386-
"to <git@vger.kernel.org>. Thanks.\n"),
387-
command_name);
395+
_("If you still use this command, here's what you can do:\n"
396+
"\n"
397+
"- read https://git-scm.com/docs/BreakingChanges.html\n"
398+
"- check if anyone has discussed this on the mailing\n"
399+
" list and if they came up with something that can\n"
400+
" help you: https://lore.kernel.org/git/?q=%s\n"
401+
"- send an email to <git@vger.kernel.org> to let us\n"
402+
" know that you still use this command and were unable\n"
403+
" to determine a suitable replacement\n"
404+
"\n"),
405+
percent_encoded.buf);
406+
strbuf_release(&percent_encoded);
388407
die(_("refusing to run without --i-still-use-this"));
389408
}

0 commit comments

Comments
 (0)