Re: Friendly refspecs
- From
Jeff King <peff@peff.net>
- Date
- Apr 22, 2008, 20:12 UTC
- Message-ID
- <20080422201222.GC29313@sigill.intra.peff.net>
- In-Reply-To
- <alpine.LNX.1.00.0804221259180.19665@iabervon.org>
On Tue, Apr 22, 2008 at 01:19:35PM -0400, Daniel Barkalow wrote:
> That's no good for people who make lightweight tags, since those will be > commits, and "git push <remote> tag:tag" would push refs/tags/tag to > refs/heads/tag.
Yes.
Show 6 quoted lines
> But I think the proposal was for "git push $there $name:$name", where name > gets expanded locally to refs/heads/$name, which I think should probably > work. I think it should require $name to be unambiguous locally, though, > because it wouldn't be too unusual for people to end up with the same name > for a branch and a lightweight tag, and then try pushing that name, > expecting one or the other to get pushed.
Ambiguity is already handled when we resolve the left-hand side of the refspec:
$ git branch foo $ git tag foo $ git push origin foo error: src refspec foo matches more than one. fatal: The remote end hung up unexpectedly error: failed to push some refs to '/home/peff/foo/parent/.git'
I guess you could say something like:
$ git branch dest $ git tag dest $ git push origin master:dest
and the "dest" here will become a branch. But that is because it has nothing to do with your local refs called "dest": the right-hand side is purely a remote matter. If the remote has an ambiguous "dest", then we already handle that case:
$ cd ../parent && git branch dest && git tag dest $ cd ../child && git push origin master:dest error: dst refspec dest matches more than one. fatal: The remote end hung up unexpectedly error: failed to push some refs to '/home/peff/foo/parent/.git'
-Peff