Subject: Re: [PATCH v2] git-rebase: Teach rebase "-" shorthand.

From: John Keeping <[email-masked]>
Date: Wed, 19 Mar 2014 19:55:03 +0000

On Wed, Mar 19, 2014 at 12:41:31PM -0700, Junio C Hamano wrote:
> John Keeping <[email-masked]> writes:
> 
> > On Wed, Mar 19, 2014 at 12:02:01PM -0700, Junio C Hamano wrote:
> >> John Keeping <[email-masked]> writes:
> >> 
> >> > On Wed, Mar 19, 2014 at 10:53:01AM -0700, Junio C Hamano wrote:
> >> >>    "rebase -" with your change still says something like this:
> >> >> 
> >> >>         First, rewinding head to replay your work on top of it...
> >> >>         Fast-forwarded HEAD to @{-1}.
> >> >> 
> >> >>    instead of "Fast-forwarded HEAD to -".  Somebody may later want
> >> >>    to "fix" this, making these two eye-candy output to be different
> >> >>    from each other, and what your test expects will no longer hold
> >> >>    (not that I think it is better to say "-" instead of @{-1}
> >> >>    there).
> >> >
> >> > I don't think either of these is correct.  When using "-" with the
> >> > commands that already support it, I have occasionally found that "-"
> >> > isn't what I thought it was.
> >> >
> >> > Can we use `git name-rev` to put the actual name here, so that people
> >> > who have not done what they intended can hopefully notice sooner?
> >> 
> >> That sounds like a right thing to do.  It however is totally
> >> orthogonal to the change we are discussing, and should be done as a
> >> separate patch.
> >
> > Is it not part of adding support for "-"?
> 
> I thought your suggestion was:
> 
>     'rebase @{-1}' says 'Fast-fowarded HEAD to @{-1}'. It should say
>     'Fast-forwarded HEAD to 4f407407 (rebase: allow "-" short-hand
>     for the previous branch, 2014-03-19)' instead.
> 
> Or it could be:
> 
>     'rebase @{-1}' says 'Fast-fowarded HEAD to @{-1}'. It should say
>     'Fast-forwarded HEAD to master' instead.
> 
> In either case, it does not look like such a change is about
> teaching "-" as a synonym to "@{-1}".

My suggestion was specifically:

    'rebase -' says 'Fast-forwarded HEAD to -'.  It should say
    'Fast-forwarded HEAD to master' instead.

I'm not sure it's desirable to attempt to canonicalise whatever the user
writes on the command line, but since we're special-casing '-' I think
it is a good thing to print the branch name in that case.