summaryrefslogtreecommitdiff
path: root/builtin/receive-pack.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2021-09-09 09:47:08 +0000
committerJunio C Hamano <gitster@pobox.com>2021-09-09 12:56:11 -0700
commitc4dee2c0851f3a6b202afd2c9d979ed417f4bcdc (patch)
tree26bb6f2a86a488dbd3e3c46ca7a34b449e5bc3f5 /builtin/receive-pack.c
parent5a22a334cb757753230f1d73da36130513016830 (diff)
downloadgit-c4dee2c0851f3a6b202afd2c9d979ed417f4bcdc.tar.gz
Close object store closer to spawning child processes
In many cases where we spawned child processes that _may_ trigger a repack, we explicitly closed the object store first (so that the `repack` process can delete the `.pack` files, which would otherwise not be possible on Windows since files cannot be deleted as long as they as still in use). Wherever possible, we now use the new `close_object_store` bit of the `run_command()` API, to delay closing the object store even further. This makes the code easier to maintain because it is now more obvious that we only release those file handles because of those child processes. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/receive-pack.c')
-rw-r--r--builtin/receive-pack.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 2d1f97e1ca..9d5e0e3d11 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -2580,10 +2580,9 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
proc.no_stdin = 1;
proc.stdout_to_stderr = 1;
proc.err = use_sideband ? -1 : 0;
- proc.git_cmd = 1;
+ proc.git_cmd = proc.close_object_store = 1;
proc.argv = argv_gc_auto;
- close_object_store(the_repository->objects);
if (!start_command(&proc)) {
if (use_sideband)
copy_to_sideband(proc.err, -1, NULL);