Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

git worktree add /foo <TAB>



The second argument to 'git worktree add' can be any committish.  That
committish becomes HEAD of the new worktree, and if it's a branch name,
then that branch becomes the current branch of the new worktree, else
the new worktree starts as a detached HEAD.

How should that be completed?

Currently it's completed as follows:

+++ b/Completion/Unix/Command/_git
@@ -2026,11 +2026,7 @@ _git-worktree() {
       curcontext=${curcontext%:*}-$line[1]:
       case $line[1] in
         (add)
 	  if (( $words[(I)--detach] )); then
 	    args=( ':commit:__git_commits' )
 	  else
 	    args=( ':branch:__git_branch_names' )
 	  fi

… and while simply using __git_commits unconditionally wouldn't be
wrong, I think this case might prefer a variant of __git_commits that
offers branch names in preference to the N other things __git_commits
offers.  Do we have such a helper?

(Or should I just add another tag-order style to my config...?)

I see __git_recent_branches but it's not precisely what I have in mind.

Cheers,

Daniel



Messages sorted by: Reverse Date, Date, Thread, Author