Skip to content

Commit 098230f

Browse files
LemmingAvalanchegitster
authored andcommitted
you-still-use-that??: help the user help themselves
Give the user a list of suggestions for what to do when they run a deprecated command. The first order of action will be to check the breaking changes document;[1] this short error message says nothing about why this command is deprecated, and in any case going into any kind of detail might overwhelm the user. Then they can find out if this has been discussed on the mailing list. Then users who e.g. are using git-whatchanged(1) can learn that this is arguably a plug-in replacement: git log <opts> --raw --no-merges Finally they are invited to send an email to the mailing list. Also drop the “please add” part in favor of just using the “refusing” die-message; these two would have been right after each other in this new version. Also drop “Thanks” since it now would require a new paragraph. [1]: www.git-scm.com has a disclaimer for these internal documents that says that “This information is specific to the Git project”. That’s misleading in this particular case. But users are unlikely to get discouraged from reading about why they (or their programs) cannot run a command any more; it clearly concerns them. Helped-by: Eric Sunshine <[email protected]> Signed-off-by: Kristoffer Haugsbakk <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 65d33db commit 098230f

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

usage.c

Lines changed: 18 additions & 5 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
{
@@ -377,12 +378,24 @@ void bug_fl(const char *file, int line, const char *fmt, ...)
377378

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

0 commit comments

Comments
 (0)