Re: problem pushing repository

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Raimund Bauer <ray007@xxxxxxx> 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@xxxxxxxxxxx>
---
 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.
-
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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux