mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Derrick Stolee via GitGitGadget" <>
	Junio C Hamano <>,
	Derrick Stolee <>
Subject: [PATCH 2/3] packfile: close commit-graph in close_all_packs
Date: Fri, 17 May 2019 11:41:48 -0700 (PDT)	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

From: Derrick Stolee <>

The close_all_packs() method is used to close all read handles to
pack-files and the multi-pack-index before running 'git gc --auto'.
This is particularly important on the Windows platform, where read
handles block any writes to those files. Replacing one of these
files with a rename() will fail in this situation.

The commit-graph also performs a rename, so is susceptable to this
problem. We are careful to close the commit-graph before writing,
but that doesn't work when a 'git fetch' (or similar) process runs
'git gc --auto' which may write a commit-graph.

Here, close the commit-graph as part of close_all_packs().

Reported-by: Johannes Schindelin <>
Signed-off-by: Derrick Stolee <>
 packfile.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/packfile.c b/packfile.c
index 16bcb75262..ce12bffe3e 100644
--- a/packfile.c
+++ b/packfile.c
@@ -16,6 +16,7 @@
 #include "tree.h"
 #include "object-store.h"
 #include "midx.h"
+#include "commit-graph.h"
 char *odb_pack_name(struct strbuf *buf,
 		    const unsigned char *sha1,
@@ -350,6 +351,8 @@ void close_all_packs(struct raw_object_store *o)
 		o->multi_pack_index = NULL;
+	close_commit_graph(o);

  parent reply	other threads:[~2019-05-17 18:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-17 18:41 [PATCH 0/3] Close commit-graph before calling 'gc' Derrick Stolee via GitGitGadget
2019-05-17 18:41 ` [PATCH 1/3] commit-graph: use raw_object_store when closing Derrick Stolee via GitGitGadget
2019-05-17 18:41 ` Derrick Stolee via GitGitGadget [this message]
2019-05-17 18:41 ` [PATCH 3/3] packfile: close_all_packs to close_object_store Derrick Stolee via GitGitGadget
2019-05-20 10:01   ` Johannes Schindelin
2019-05-20 11:55     ` Derrick Stolee
2019-05-28 16:29       ` Junio C Hamano
2019-05-19  2:04 ` [PATCH 0/3] Close commit-graph before calling 'gc' Junio C Hamano
2019-05-20 10:13   ` Johannes Schindelin
2019-05-20 11:05   ` Derrick Stolee
2019-05-20  9:40 ` Johannes Schindelin

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:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \

* 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.
Code repositories for project(s) associated with this public inbox

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 read-only IMAP folder(s) and NNTP newsgroup(s).