{"thread":{"id":"16744","subject":"[PATCH] fast-import: close pack before unlinking it","startedAt":"2008-12-15T21:11:40Z","lastAt":"2008-12-15T21:11:40Z","messageCount":1,"participants":["Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"98001","messageId":"alpine.DEB.1.00.0812152210480.30769@pacific.mpi-cbg.de","threadId":"16744","inReplyTo":null,"subject":"[PATCH] fast-import: close pack before unlinking it","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-12-15T21:11:40Z","receivedAt":"2008-12-15T21:11:40Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nThis is sort of a companion patch to 4723ee9(Close files opened by\nlock_file() before unlinking.): on Windows, you cannot delete what\nis still open.\n\nThis makes test 9300-fast-import pass on Windows for me; quite a few\nfast-imports leave temporary packs until the test \"blank lines not\nnecessary after other commands\" actually tests for the number of files\nin .git/objects/pack/, which has a few temporary packs now.\n\nI guess that 8b4eb6b(Do not perform cross-directory renames when\ncreating packs) was \"responsible\" for the breakage.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n fast-import.c |    4 +++-\n 1 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/fast-import.c b/fast-import.c\nindex 3276d5d..201d4ff 100644\n--- a/fast-import.c\n+++ b/fast-import.c\n@@ -983,8 +983,10 @@ static void end_packfile(void)\n \n \t\tpack_id++;\n \t}\n-\telse\n+\telse {\n+\t\tclose(old_p->pack_fd);\n \t\tunlink(old_p->pack_name);\n+\t}\n \tfree(old_p);\n \n \t/* We can't carry a delta across packfiles. */\n-- \n1.6.1.rc3.368.g63acc\n"}]}