Don't close pack fd when free'ing pack windows
commit7c3ecb32541d767518bf78633603f94fefdac8cf
authorBrandon Casey <drafnel@gmail.com>
Wed, 31 Jul 2013 19:51:37 +0000 (31 12:51 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 2 Aug 2013 16:27:26 +0000 (2 09:27 -0700)
treebf5ca4bc5f1b7d5f0b7451e8b737c9fc1ffe4db3
parent88d0db55579cd2173ce641849066da8b897b58da
Don't close pack fd when free'ing pack windows

Now that close_one_pack() has been introduced to handle file
descriptor pressure, it is not strictly necessary to close the
pack file descriptor in unuse_one_window() when we're under memory
pressure.

Jeff King provided a justification for leaving the pack file open:

   If you close packfile descriptors, you can run into racy situations
   where somebody else is repacking and deleting packs, and they go away
   while you are trying to access them. If you keep a descriptor open,
   you're fine; they last to the end of the process. If you don't, then
   they disappear from under you.

   For normal object access, this isn't that big a deal; we just rescan
   the packs and retry. But if you are packing yourself (e.g., because
   you are a pack-objects started by upload-pack for a clone or fetch),
   it's much harder to recover (and we print some warnings).

Let's do so (or uh, not do so).

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/pack-objects.c
git-compat-util.h
sha1_file.c