Re: Friendly refspecs
- From
Andreas Ericsson <ae@op5.se>
- Date
- Apr 23, 2008, 06:24 UTC
- Message-ID
- <480ED60D.7050708@op5.se>
- In-Reply-To
- <7v1w4xuni1.fsf@gitster.siamese.dyndns.org>
Junio C Hamano wrote:
Show 29 quoted lines
> Teemu Likonen <tlikonen@iki.fi> writes: > >> Junio C Hamano wrote (2008-04-22 13:45 -0700): >> >>> I thought the original poster's example was >>> >>> git push $there $commit:branch2 >>> >>> where $commit happened to be "branch1". Would we dwim >>> >>> git push $there branch1~4:this_is_known_ok >>> >>> to refs/heads/? >> I guess this is what I meant. My original question was about >> inconsistent user interface: "git push $there branch1" creates branch1 >> on the remote side (if it does not exist) but "git push $there >> branch1:branch2" gives an error if branch2 does not exist >> (branch1:refs/heads/branch2 is required). >> >> The case has become much more complicated since, so I just speak aloud >> my hope that need for refs/ paths in common situations would be reduced >> to minimum. > > I think everybody involved in this discussion understands _that_. The > issue is that you would not have said "branch2" in real life, but used > some word that is _not_ "branch" to name the thing, and there is no way > for git to guess correctly if you meant to create a branch or a > light-weight tag. >
If the src ref is not a commit sha1, the user will almost certainly want to create the same *type* of ref on the remote side, so
git tag foo git branch boo git push $there foo:wip git push $there boo:wip-2008-04-24
would, on the remote side, create the branch "wip" and the tag "wip-2008-04-24"
I for one would certainly like that, and I don't think very many will be surprised at that behaviour.
-- Andreas Ericsson andreas.ericsson@op5.se OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231