summaryrefslogtreecommitdiff
path: root/commit.h
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-06-06 07:29:34 +0200
committerJunio C Hamano <gitster@pobox.com>2024-06-06 09:04:33 -0700
commit1339cb3c47aafb08a51d2517fcbaed2954d7d127 (patch)
tree5ed51c26c3de0b3b4bc56d6c723611049ca214fa /commit.h
parentb5d7db9e83e16cad6fb2a055029a8d1c72af04c9 (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 'commit.h')
0 files changed, 0 insertions, 0 deletions