summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2021-09-08 08:29:31 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-09-08 19:17:15 (GMT)
commit7e44ff7a3983ad0c7be5c9edcfea2e8355ce9a65 (patch)
tree720dc1d55bc6f79a07c4ceaacd05268fdb0dac5b /builtin
parent957ba814bf93b698742ffa3cf37e4f665ed95b45 (diff)
downloadgit-7e44ff7a3983ad0c7be5c9edcfea2e8355ce9a65.zip
git-7e44ff7a3983ad0c7be5c9edcfea2e8355ce9a65.tar.gz
git-7e44ff7a3983ad0c7be5c9edcfea2e8355ce9a65.tar.bz2
pull: release packs before fetching
On Windows, files cannot be removed nor renamed if there are still handles held by a process. To remedy that, we try to release all open handles to any `.pack` file before e.g. repacking (which would want to remove the original `.pack` file(s) after it is done). Since the `read_cache_unmerged()` and/or the `get_oid()` call in `git pull` can cause `.pack` files to be opened, we need to release the open handles before calling `git fetch`: the latter process might want to spawn an auto-gc, which in turn might want to repack the objects. This commit is similar in spirit to 5bdece0d705 (gc/repack: release packs when needed, 2018-12-15). This fixes https://github.com/git-for-windows/git/issues/3336. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/pull.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/pull.c b/builtin/pull.c
index 3e13f81..d9f0156 100644
--- a/builtin/pull.c
+++ b/builtin/pull.c
@@ -26,6 +26,7 @@
#include "wt-status.h"
#include "commit-reach.h"
#include "sequencer.h"
+#include "packfile.h"
/**
* Parses the value of --rebase. If value is a false value, returns
@@ -998,6 +999,7 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
oidclr(&rebase_fork_point);
}
+ close_object_store(the_repository->objects);
if (run_fetch(repo, refspecs))
return 1;