aboutsummaryrefslogtreecommitdiffstats
path: root/help.c
diff options
context:
space:
mode:
Diffstat (limited to 'help.c')
-rw-r--r--help.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/help.c b/help.c
index 8b56cd6e25..8a830ba35c 100644
--- a/help.c
+++ b/help.c
@@ -612,7 +612,7 @@ 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)
+char *help_unknown_cmd(const char *cmd)
{
struct help_unknown_cmd_config cfg = { 0 };
int i, n, best_similarity = 0;
@@ -695,9 +695,8 @@ const char *help_unknown_cmd(const char *cmd)
; /* still counting */
}
if (cfg.autocorrect && n == 1 && SIMILAR_ENOUGH(best_similarity)) {
- const char *assumed = main_cmds.names[0]->name;
- main_cmds.names[0] = NULL;
- cmdnames_release(&main_cmds);
+ char *assumed = xstrdup(main_cmds.names[0]->name);
+
fprintf_ln(stderr,
_("WARNING: You called a Git command named '%s', "
"which does not exist."),