From c74faea19e39ca933492f697596310397175c329 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Tue, 9 Dec 2008 14:26:52 -0500 Subject: make sure packs to be replaced are closed beforehand Especially on Windows where an opened file cannot be replaced, make sure pack-objects always close packs it is about to replace. Even on non Windows systems, this could save potential bad results if ever objects were to be read from the new pack file using offset from the old index. This should fix t5303 on Windows. Signed-off-by: Nicolas Pitre Tested-by: Johannes Sixt (MinGW) Signed-off-by: Junio C Hamano --- builtin-pack-objects.c | 1 + 1 file changed, 1 insertion(+) (limited to 'builtin-pack-objects.c') diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c index 4411a480c1..fb5e14d56e 100644 --- a/builtin-pack-objects.c +++ b/builtin-pack-objects.c @@ -520,6 +520,7 @@ static void write_pack_file(void) snprintf(tmpname, sizeof(tmpname), "%s-%s.pack", base_name, sha1_to_hex(sha1)); + free_pack_by_name(tmpname); if (adjust_perm(pack_tmp_name, mode)) die("unable to make temporary pack file readable: %s", strerror(errno)); -- cgit v1.2.3