diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-06-06 07:29:34 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-06-06 09:04:33 -0700 |
commit | 1339cb3c47aafb08a51d2517fcbaed2954d7d127 (patch) | |
tree | 5ed51c26c3de0b3b4bc56d6c723611049ca214fa /builtin/count-objects.c | |
parent | b5d7db9e83e16cad6fb2a055029a8d1c72af04c9 (diff) |
worktree: don't store main worktree twice
In `get_worktree_ref_store()` we either return the repository's main ref
store, or we look up the ref store via the map of worktree ref stores.
Which of these worktrees gets picked depends on the `is_current` bit of
the worktree, which indicates whether the worktree is the one that
corresponds to `the_repository`.
The bit is getting set in `get_worktrees()`, but only after we have
computed the list of all worktrees. This is too late though, because at
that time we have already called `get_worktree_ref_store()` on each of
the worktrees via `add_head_info()`. The consequence is that the current
worktree will not have been marked accordingly, which means that we did
not use the main ref store, but instead created a new ref store. We thus
have two separate ref stores now that map to the same ref database.
Fix this by setting `is_current` before we call `add_head_info()`.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/count-objects.c')
0 files changed, 0 insertions, 0 deletions