summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-07-31 13:51:05 -0700
committerJunio C Hamano <gitster@pobox.com>2017-07-31 13:51:05 -0700
commit133578a020ac5449d36cea741cfc1e7acd7f93a8 (patch)
treed1594e7add0085de89c382e7b1567c16d13d3583 /builtin
parent309ff914d5ae1cdc95c826f7ac45b859e1d43d67 (diff)
parentc45af94dbc960cbb46ac482ec9cb7f73f55ea270 (diff)
downloadgit-133578a020ac5449d36cea741cfc1e7acd7f93a8.tar.gz
Merge branch 'jk/gc-pre-detach-under-hook' into maint
We run an early part of "git gc" that deals with refs before daemonising (and not under lock) even when running a background auto-gc, which caused multiple gc processes attempting to run the early part at the same time. This is now prevented by running the early part also under the GC lock. * jk/gc-pre-detach-under-hook: gc: run pre-detach operations under lock
Diffstat (limited to 'builtin')
-rw-r--r--builtin/gc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/builtin/gc.c b/builtin/gc.c
index 91f7696a85..2d2027d8b0 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -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