Skip to content

Commit 5472c32

Browse files
derrickstoleegitster
authored andcommitted
packfile: close commit-graph in close_all_packs
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 <[email protected]> Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c3a3a96 commit 5472c32

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packfile.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "tree.h"
1717
#include "object-store.h"
1818
#include "midx.h"
19+
#include "commit-graph.h"
1920

2021
char *odb_pack_name(struct strbuf *buf,
2122
const unsigned char *sha1,
@@ -350,6 +351,8 @@ void close_all_packs(struct raw_object_store *o)
350351
close_midx(o->multi_pack_index);
351352
o->multi_pack_index = NULL;
352353
}
354+
355+
close_commit_graph(o);
353356
}
354357

355358
/*

0 commit comments

Comments
 (0)