Merge branch 'maint'
[git/git.git] / git.c
diff --git a/git.c b/git.c
index 5582c51..00f5dd1 100644 (file)
--- a/git.c
+++ b/git.c
@@ -366,7 +366,7 @@ static void handle_internal_command(int argc, const char **argv)
        if (sizeof(ext) > 1) {
                i = strlen(argv[0]) - strlen(ext);
                if (i > 0 && !strcmp(argv[0] + i, ext)) {
        if (sizeof(ext) > 1) {
                i = strlen(argv[0]) - strlen(ext);
                if (i > 0 && !strcmp(argv[0] + i, ext)) {
-                       char *argv0 = strdup(argv[0]);
+                       char *argv0 = xstrdup(argv[0]);
                        argv[0] = cmd = argv0;
                        argv0[i] = '\0';
                }
                        argv[0] = cmd = argv0;
                        argv0[i] = '\0';
                }
@@ -501,7 +501,9 @@ int main(int argc, const char **argv)
                                cmd, argv[0]);
                        exit(1);
                }
                                cmd, argv[0]);
                        exit(1);
                }
-               help_unknown_cmd(cmd);
+               argv[0] = help_unknown_cmd(cmd);
+               handle_internal_command(argc, argv);
+               execv_dashed_external(argv);
        }
 
        fprintf(stderr, "Failed to run command '%s': %s\n",
        }
 
        fprintf(stderr, "Failed to run command '%s': %s\n",