diff options
author | Patrick Steinhardt <ps@pks.im> | 2025-06-03 16:01:20 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2025-06-03 08:30:52 -0700 |
commit | 1b5074e614d9b32bd760d2583e7435685ca4faab (patch) | |
tree | 71ba44b7a1eb408f54b04921ecfeaa1a981bc414 /git-gui/lib/commit.tcl | |
parent | d2b084c66037f1a77b3e061ae7e4d96cbdbf6c05 (diff) |
builtin/maintenance: fix locking race when handling "gc" task
The "gc" task has a similar locking race as the one that we have fixed
for the "pack-refs" and "reflog-expire" tasks in preceding commits. Fix
this by splitting up the logic of the "gc" task:
- We execute `gc_before_repack()` in the foreground, which contains
the logic that git-gc(1) itself would execute in the foreground, as
well.
- We spawn git-gc(1) after detaching, but with a new hidden flag that
suppresses calling `gc_before_repack()`.
Like this we have roughly the same logic as git-gc(1) itself and know to
repack refs and reflogs before detaching, thus fixing the race.
Note that `gc_before_repack()` is renamed to `gc_foreground_tasks()` to
better reflect what this function does.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-gui/lib/commit.tcl')
0 files changed, 0 insertions, 0 deletions