Hi Junio, On Tue, 25 Aug 2020, Junio C Hamano wrote: > diff --git a/git.c b/git.c > index 8bd1d7551d..927018bda7 100644 > --- a/git.c > +++ b/git.c > @@ -839,6 +839,8 @@ int cmd_main(int argc, const char **argv) > * that one cannot handle it. > */ > if (skip_prefix(cmd, "git-", &cmd)) { > + warn_on_dashed_git(argv[0]); > + > argv[0] = cmd; > handle_builtin(argc, argv); > die(_("cannot handle %s as a builtin"), cmd); > diff --git a/help.c b/help.c > index d478afb2af..490d2bc3ae 100644 > --- a/help.c > +++ b/help.c > @@ -720,3 +720,37 @@ NORETURN void help_unknown_ref(const char *ref, const char *cmd, > string_list_clear(&suggested_refs, 0); > exit(1); > } > + > +static struct cmdname_help *find_cmdname_help(const char *name) > +{ > + int i; > + > + for (i = 0; i < ARRAY_SIZE(command_list); i++) { > + if (!strcmp(command_list[i].name, name)) > + return &command_list[i]; > + } > + return NULL; > +} > + > +void warn_on_dashed_git(const char *cmd) > +{ > + struct cmdname_help *cmdname; > + static const char *still_in_use_var = "GIT_I_STILL_USE_DASHED_GIT"; > + static const char *still_in_use_msg = > + N_("Use of '%s' in the dashed-form is nominated for removal.\n" > + "If you still use it, export '%s=true'\n" > + "and send an e-mail to <git@xxxxxxxxxxxxxxx>\n" > + "to let us know and stop our removal plan. Thanks.\n"); > + > + if (!cmd) > + return; /* git-help is OK */ > + > + cmdname = find_cmdname_help(cmd); > + if (cmdname && (cmdname->category & CAT_onpath)) > + return; /* git-upload-pack and friends are OK */ > + > + if (!git_env_bool(still_in_use_var, 0)) { > + fprintf(stderr, _(still_in_use_msg), cmd, still_in_use_var); > + exit(1); > + } > +} I need this on top, to make it work on Windows: -- snipsnap -- From: Johannes Schindelin <johannes.schindelin@xxxxxx> Subject: [PATCH] fixup??? git: catch an attempt to run "git-foo" This is needed to handle the case where `argv[0]` contains the full path (which is the case on Windows) and the suffix `.exe` (which is also the case on Windows). Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> --- git.c | 3 ++- help.c | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/git.c b/git.c index 71ef4835b20e..863fd0c58a66 100644 --- a/git.c +++ b/git.c @@ -851,7 +851,8 @@ int cmd_main(int argc, const char **argv) * that one cannot handle it. */ if (skip_prefix(cmd, "git-", &cmd)) { - warn_on_dashed_git(argv[0]); + strip_extension(&cmd); + warn_on_dashed_git(cmd); argv[0] = cmd; handle_builtin(argc, argv); diff --git a/help.c b/help.c index c93a76944b00..27b1b26890be 100644 --- a/help.c +++ b/help.c @@ -724,9 +724,12 @@ NORETURN void help_unknown_ref(const char *ref, const char *cmd, static struct cmdname_help *find_cmdname_help(const char *name) { int i; + const char *p; + skip_prefix(name, "git-", &name); for (i = 0; i < ARRAY_SIZE(command_list); i++) { - if (!strcmp(command_list[i].name, name)) + if (skip_prefix(command_list[i].name, "git-", &p) && + !strcmp(p, name)) return &command_list[i]; } return NULL; -- 2.28.0.windows.1