]> git.ipfire.org Git - thirdparty/git.git/commit
pull: release packs before fetching
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Wed, 8 Sep 2021 08:29:31 +0000 (08:29 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 8 Sep 2021 19:17:15 +0000 (12:17 -0700)
commit7e44ff7a3983ad0c7be5c9edcfea2e8355ce9a65
tree720dc1d55bc6f79a07c4ceaacd05268fdb0dac5b
parent957ba814bf93b698742ffa3cf37e4f665ed95b45
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>
builtin/pull.c