X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=help.c;h=42193550f0b6f2a2c703c20c7abf1a81fe1b51d0;hb=592ed5673e3074a0d7e0a6d6626faa783c327c29;hp=7654f1bfd608d151a213937614449cc497bb638b;hpb=bac9c06ba093d9254cb2ab3eed074722a3e635a6;p=git.git diff --git a/help.c b/help.c index 7654f1bfd..42193550f 100644 --- a/help.c +++ b/help.c @@ -302,6 +302,10 @@ static void add_cmd_list(struct cmdnames *cmds, struct cmdnames *old) #define SIMILARITY_FLOOR 7 #define SIMILAR_ENOUGH(x) ((x) < SIMILARITY_FLOOR) +static const char bad_interpreter_advice[] = + N_("'%s' appears to be a git command, but we were not\n" + "able to execute it. Maybe git-%s is broken?"); + const char *help_unknown_cmd(const char *cmd) { int i, n, best_similarity = 0; @@ -326,6 +330,14 @@ const char *help_unknown_cmd(const char *cmd) int cmp = 0; /* avoid compiler stupidity */ const char *candidate = main_cmds.names[i]->name; + /* + * An exact match means we have the command, but + * for some reason exec'ing it gave us ENOENT; probably + * it's a bad interpreter in the #! line. + */ + if (!strcmp(candidate, cmd)) + die(_(bad_interpreter_advice), cmd, cmd); + /* Does the candidate appear in common_cmds list? */ while (n < ARRAY_SIZE(common_cmds) && (cmp = strcmp(common_cmds[n].name, candidate)) < 0)