Skip to content

pr-2339/letmaik/worktree-add-path-checks-v1

tagged this 28 Nov 23:06
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.

Detached git worktree add --no-checkout with 200 existing linked
worktrees. Median of seven runs per version, with 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.git.1795907202117.gitgitgadget@gmail.com
Assets 2
Loading