Raimund Bauer <ray007@xxxxxxx> wrote: > On Fri, 2007-06-22 at 18:47 -0400, Shawn O. Pearce wrote: > > Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx> > > --- > > contrib/completion/git-completion.bash | 2 +- > > 1 files changed, 1 insertions(+), 1 deletions(-) > > Thanks a lot, your patch makes my life easier. > Since you obviously know what you're doing here, maybe I can wish for > something too? Heh, sure. I wrote that "stock" bash completion package, but at this point I largely consider it to be "complete and stable" and therefore don't put a lot of effort into it anymore. This recent thread has been interesting, as it has uncovered two bugs related to the git-push completion. > It would be really cool if completion also worked when I started the > branchname with a '+' to force the push ... How does this work? ;-) I'm pushing it out to my fastimport tree shortly. -->8-- Teach bash how to complete +refspec on git-push Using `git push origin +foo` to forcefully overwrite the remote branch named foo is a common idiom, especially since + is shorter than the long option --force and can be specified on a per-branch basis. We now complete `git push origin +foo` just like we do the standard `git push origin foo`. The leading + on a branch refspec does not alter the completion. Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx> --- contrib/completion/git-completion.bash | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index c7c9963..f2b10fa 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -682,6 +682,9 @@ _git_push () esac __gitcomp "$(__git_refs "$remote")" "" "${cur#*:}" ;; + +*) + __gitcomp "$(__git_refs)" + "${cur#+}" + ;; *) __gitcomp "$(__git_refs)" ;; -- 1.5.2.2.1334.g1625 -- Shawn. - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html