All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Shawn O. Pearce" <spearce@spearce.org>
To: Raimund Bauer <ray007@gmx.net>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Andrew Ruder <andy@aeruder.net>,
	git@vger.kernel.org
Subject: Re: problem pushing repository
Date: Fri, 22 Jun 2007 18:47:12 -0400	[thread overview]
Message-ID: <20070622224712.GI17393@spearce.org> (raw)
In-Reply-To: <1182519484.6207.38.camel@localhost>

Raimund Bauer <ray007@gmx.net> wrote:
> On Fri, 2007-06-22 at 12:26 +0100, Johannes Schindelin wrote: 
> > On Fri, 22 Jun 2007, Raimund Bauer wrote:
> > 
> > > $ git push slcom test:test 
> > > error: dst refspec test does not match any existing ref on the remote
> > > and does not start with refs/.
> > 
> > It says that there is no branch named "test" on the remote side, and since 
> > you could also want to push a tag, you have to say
> > 
> > 	test:refs/heads/test
> > 
> > here. However, I do not understand why you bother to use the :dst syntax 
> > here, since your target name is _exactly_ the same as the source name. Why 
> > not just
> > 
> > 	git push slcom test
> 
> because I had gotten the command line from bash-completion

I just patched the bash completion package to offer `git push slcom
test` as the completion, instead of `git push slcom test:test`.
The patch was pretty trivial, and is now also in my fastimport.git
tree on repo.or.cz.

-->8--
Avoid src:dst syntax as default bash completion for git push

Raimund Bauer just discovered that the default bash completion for
a local branch name in a git-push line is not the best choice when
the branch does not exist on the remote system.

In the past we have always completed the local name 'test' as
"test:test", indicating that the destination name is the same as
the local name.  But this fails when "test" does not yet exist on
the remote system, as there is no "test" branch for it to match
the name against.

Fortunately git-push does the right thing when given just the
local branch, as it assumes you want to use the same name in the
destination repository.  So we now offer "test" as the completion
in a git-push line, and let git-push assume that is also the remote
branch name.

We also still support the remote branch completion after the :,
but only if the user manually adds the colon before trying to get
a completion.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 contrib/completion/git-completion.bash |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 9e72f0f..c7c9963 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -683,7 +683,7 @@ _git_push ()
 			__gitcomp "$(__git_refs "$remote")" "" "${cur#*:}"
 			;;
 		*)
-			__gitcomp "$(__git_refs2)"
+			__gitcomp "$(__git_refs)"
 			;;
 		esac
 		;;
-- 
1.5.2.2.1050.g51a8b

-- 
Shawn.

  reply	other threads:[~2007-06-22 22:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-22  1:49 problem pushing repository Adam Mercer
2007-06-22  2:00 ` Junio C Hamano
2007-06-22  2:24   ` Andrew Ruder
2007-06-22  7:21     ` Raimund Bauer
2007-06-22 11:26       ` Johannes Schindelin
2007-06-22 13:38         ` Raimund Bauer
2007-06-22 22:47           ` Shawn O. Pearce [this message]
2007-06-23 10:12             ` Raimund Bauer
2007-06-24 23:47               ` Shawn O. Pearce
2007-06-25  1:01                 ` Jakub Narebski
2007-06-22 13:36     ` Adam Mercer
2007-06-22 14:17       ` Raimund Bauer
2007-06-22 14:32         ` Adam Mercer
2007-06-22 13:23   ` Adam Mercer
2007-06-22  7:20 ` Johannes Sixt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070622224712.GI17393@spearce.org \
    --to=spearce@spearce.org \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=andy@aeruder.net \
    --cc=git@vger.kernel.org \
    --cc=ray007@gmx.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.