summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-07-18 12:48:10 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-07-18 12:48:10 -0700
commit764046f6b0ea8480ef7f79dd2b9c48cab0c32d22 (patch)
tree93ed2ebca9705953bfee7f6238c93463893a880a /builtin
parentMerge branch 'jn/hooks-pre-rebase-sample-fix' (diff)
parentgc: run pre-detach operations under lock (diff)
downloadtgif-764046f6b0ea8480ef7f79dd2b9c48cab0c32d22.tar.xz
Merge branch 'jk/gc-pre-detach-under-hook'
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 2ba50a2873..e6b84475ae 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -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