Repository navigation
pr-2339/letmaik/worktree-add-path-checks-v2
tagged this
29 Nov 05:41
From: Maik Riechert <letmaik@outlook.com>
add_worktree() calls get_worktrees() to check whether the destination
matches a registered worktree. This also resolves HEAD for the
enumerated worktrees, although check_candidate_path() only needs their
paths, IDs and lock state.
Use get_worktrees_without_reading_head() for the destination check to
avoid these unnecessary lookups.
Measured with 'git worktree add --detach --no-checkout' on a repository
with 200 existing linked worktrees (median of seven runs per version,
warm caches):
before after
files 11.13 ms 6.77 ms
reftable 18.86 ms 7.60 ms
Signed-off-by: Maik Riechert <letmaik@outlook.com>
Submitted-As: https://lore.kernel.org/git/pull.2339.v2.git.1795930874388.gitgitgadget@gmail.com
In-Reply-To: https://lore.kernel.org/git/pull.2339.git.1795907202117.gitgitgadget@gmail.com