Re: Friendly refspecs
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 23, 2008, 05:52 UTC
- Message-ID
- <7v1w4xuni1.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <20080423042433.GA3291@mithlond.arda.local>
Teemu Likonen <tlikonen@iki.fi> writes:
Show 21 quoted lines
> 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.
There is no inconsistency. "push $branch1" has a special case logic to favor "the same name". You invoked "src:dst" syntax that is general purpose which does not dwim.
Historically we did not favor one way or another for the general purpose syntax. I think Jeff's proposed heuristics to favor branch if a branch tip is pushed and tag if a tag is pushed makes sense.