From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH] gc --auto: do not run 'pack-refs' and 'reflog expire' twice
Date: Sun, 31 Aug 2014 11:33:30 +0700 [thread overview]
Message-ID: <1409459610-8695-1-git-send-email-pclouds@gmail.com> (raw)
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@gmail.com>
---
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
next reply other threads:[~2014-08-31 4:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-31 4:33 Nguyễn Thái Ngọc Duy [this message]
2014-09-02 18:12 ` [PATCH] gc --auto: do not run 'pack-refs' and 'reflog expire' twice Junio C Hamano
2014-09-02 19:16 ` Junio C Hamano
2014-09-04 14:13 ` Duy Nguyen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1409459610-8695-1-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).