completion: fix __git_complete_worktree_paths

Use __git to invoke "worktree list" in __git_complete_worktree_paths, to
respect any "-C" and "--git-dir" options present on the command line.

Signed-off-by: Rubén Justo <rjusto@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Rubén Justo
2024-02-27 22:06:49 +01:00
committed by Junio C Hamano
parent 3c2a3fdc38
commit 3574816d98
2 changed files with 24 additions and 1 deletions

View File

@ -3571,7 +3571,7 @@ __git_complete_worktree_paths ()
# Generate completion reply from worktree list skipping the first
# entry: it's the path of the main worktree, which can't be moved,
# removed, locked, etc.
__gitcomp_nl "$(git worktree list --porcelain |
__gitcomp_nl "$(__git worktree list --porcelain |
sed -n -e '2,$ s/^worktree //p')"
}