Skip to content

Commit 87c8a56

Browse files
dschogitster
authored andcommitted
fast-import: close pack before unlinking it
This is sort of a companion patch to 4723ee9(Close files opened by lock_file() before unlinking.): on Windows, you cannot delete what is still open. This makes test 9300-fast-import pass on Windows for me; quite a few fast-imports leave temporary packs until the test "blank lines not necessary after other commands" actually tests for the number of files in .git/objects/pack/, which has a few temporary packs now. I guess that 8b4eb6b(Do not perform cross-directory renames when creating packs) was "responsible" for the breakage. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a833502 commit 87c8a56

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fast-import.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,8 +982,10 @@ static void end_packfile(void)
982982

983983
pack_id++;
984984
}
985-
else
985+
else {
986+
close(old_p->pack_fd);
986987
unlink(old_p->pack_name);
988+
}
987989
free(old_p);
988990

989991
/* We can't carry a delta across packfiles. */

0 commit comments

Comments
 (0)