diff options
Diffstat (limited to 'usage.c')
| -rw-r--r-- | usage.c | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -7,6 +7,7 @@ #include "git-compat-util.h" #include "gettext.h" #include "trace2.h" +#include "strbuf.h" static void vfreportf(FILE *f, const char *prefix, const char *err, va_list params) { @@ -67,6 +68,8 @@ static NORETURN void usage_builtin(const char *err, va_list params) static void die_message_builtin(const char *err, va_list params) { + if (!err) + return; trace2_cmd_error_va(err, params); vreportf(_("fatal: "), err, params); } @@ -372,3 +375,33 @@ void bug_fl(const char *file, int line, const char *fmt, ...) trace2_cmd_error_va(fmt, ap); va_end(ap); } + + +NORETURN void you_still_use_that(const char *command_name, const char *hint) +{ + struct strbuf percent_encoded = STRBUF_INIT; + strbuf_add_percentencode(&percent_encoded, + command_name, + STRBUF_ENCODE_SLASH); + + fprintf(stderr, + _("'%s' is nominated for removal.\n"), command_name); + + if (hint) + fputs(hint, stderr); + + fprintf(stderr, + _("If you still use this command, here's what you can do:\n" + "\n" + "- read https://git-scm.com/docs/BreakingChanges.html\n" + "- check if anyone has discussed this on the mailing\n" + " list and if they came up with something that can\n" + " help you: https://lore.kernel.org/git/?q=%s\n" + "- send an email to <git@vger.kernel.org> to let us\n" + " know that you still use this command and were unable\n" + " to determine a suitable replacement\n" + "\n"), + percent_encoded.buf); + strbuf_release(&percent_encoded); + die(_("refusing to run without --i-still-use-this")); +} |
