[PATCH] gc --auto: do not run 'pack-refs' and 'reflog expire' twice

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In the --auto code path, gc_before_repack() is called once in parent
process then again in the forked process. Stop the second run.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
---
 builtin/gc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/builtin/gc.c b/builtin/gc.c
index 8d219d8..fb0cff3 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -261,6 +261,11 @@ static const char *lock_repo_for_gc(int force, pid_t* ret_pid)
 
 static int gc_before_repack(void)
 {
+	static int nr_runs;
+
+	if (nr_runs++)
+		return 0;
+
 	if (pack_refs && run_command_v_opt(pack_refs_cmd.argv, RUN_GIT_CMD))
 		return error(FAILED_RUN, pack_refs_cmd.argv[0]);
 
-- 
2.1.0.rc0.78.gc0d8480

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]