log_ref_setup(): improve robustness against races
[gitweb.git] / git.c
diff --git a/git.c b/git.c
index fd3abf85d21daa3382361b415e1c66a876da8ad2..dce529fcbfd6e5d8526b0e88b43f6c568876ce9d 100644 (file)
--- a/git.c
+++ b/git.c
@@ -396,7 +396,7 @@ static struct cmd_struct commands[] = {
        { "am", cmd_am, RUN_SETUP | NEED_WORK_TREE },
        { "annotate", cmd_annotate, RUN_SETUP },
        { "apply", cmd_apply, RUN_SETUP_GENTLY },
-       { "archive", cmd_archive },
+       { "archive", cmd_archive, RUN_SETUP_GENTLY },
        { "bisect--helper", cmd_bisect__helper, RUN_SETUP },
        { "blame", cmd_blame, RUN_SETUP },
        { "branch", cmd_branch, RUN_SETUP },
@@ -654,6 +654,11 @@ int cmd_main(int argc, const char **argv)
        cmd = argv[0];
        if (!cmd)
                cmd = "git-help";
+       else {
+               const char *slash = find_last_dir_sep(cmd);
+               if (slash)
+                       cmd = slash + 1;
+       }
 
        trace_command_performance(argv);