Merge branch 'ks/doc-fixes' into maint
[gitweb.git] / builtin / gc.c
index 91f7696a85ec974d0ff5a1591cc404ed99efb7d7..2d2027d8b09913d30ce103c8c0ae4332fb729997 100644 (file)
@@ -413,8 +413,12 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
                        if (report_last_gc_error())
                                return -1;
 
+                       if (lock_repo_for_gc(force, &pid))
+                               return 0;
                        if (gc_before_repack())
                                return -1;
+                       delete_tempfile(&pidfile);
+
                        /*
                         * failure to daemonize is ok, we'll continue
                         * in foreground