git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: problem pushing repository

From
Shawn O. Pearce <spearce@spearce.org>
Date
Jun 24, 2007, 23:47 UTC
Message-ID
<20070624234759.GO17393@spearce.org>
In-Reply-To
<1182593536.5937.14.camel@localhost>
Raimund Bauer <ray007@gmx.net> wrote:
Show 9 quoted lines
> On Fri, 2007-06-22 at 18:47 -0400, Shawn O. Pearce wrote:
> > Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
> > ---
> >  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@spearce.org>
---
 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.
Previous: Raimund BauerNext: Jakub Narebski
Message 9 of 15 in “problem pushing repository”
  1. Adam MercerJun 22, 2007
  2. Junio C HamanoJun 22, 2007
  3. Andrew RuderJun 22, 2007
  4. Raimund BauerJun 22, 2007
  5. Johannes SchindelinJun 22, 2007
  6. Raimund BauerJun 22, 2007
  7. Shawn O. PearceJun 22, 2007
  8. Raimund BauerJun 23, 2007
  9. Shawn O. PearceJun 24, 2007
  10. Jakub NarebskiJun 25, 2007
  11. Adam MercerJun 22, 2007
  12. Raimund BauerJun 22, 2007
  13. Adam MercerJun 22, 2007
  14. Adam MercerJun 22, 2007
  15. Johannes SixtJun 22, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.