Skip to content

Commit f2acf76

Browse files
imomalievgitster
authored andcommitted
work around zsh comment in __git_complete_worktree_paths
[PATCH]: contrib/completion/git-completion.bash, there is a construct where comment lines are placed between the command that is on the upstream of a pipe and the command that is on the downstream of a pipe in __git_complete_worktree_paths function. Unfortunately, this script is also used by Zsh completion, but Zsh mishandles this construct when "interactive_comments" option is not set (by default it is off on macOS), resulting in a breakage: $ git worktree remove [TAB] $ git worktree remove __git_complete_worktree_paths:7: command not found: # Move the comment, even though it explains what happens on the downstream of the pipe and logically belongs where it is right now, before the entire pipeline, to work around this problem. Signed-off-by: Sardorbek Imomaliev <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 48bf2fa commit f2acf76

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

contrib/completion/git-completion.bash

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3268,9 +3268,10 @@ _git_whatchanged ()
32683268
__git_complete_worktree_paths ()
32693269
{
32703270
local IFS=$'\n'
3271+
# Generate completion reply from worktree list skipping the first
3272+
# entry: it's the path of the main worktree, which can't be moved,
3273+
# removed, locked, etc.
32713274
__gitcomp_nl "$(git worktree list --porcelain |
3272-
# Skip the first entry: it's the path of the main worktree,
3273-
# which can't be moved, removed, locked, etc.
32743275
sed -n -e '2,$ s/^worktree //p')"
32753276
}
32763277

0 commit comments

Comments
 (0)