Merge branch 'mh/packed-ref-store' into next
[gitweb.git] / builtin / gc.c
index 2ba50a28735eee23887211684e60aaeda81c3e98..e6b84475aef6aeab05beda137fb2882f663fac0f 100644 (file)
@@ -414,8 +414,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