Re: [PATCH 1/7] shorten_unambiguous_ref(): Allow shortening refs/remotes/origin/HEAD to origin

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

 



On Tue, May 7, 2013 at 11:31 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Johan Herland <johan@xxxxxxxxxxx> writes:
>> On Mon, May 6, 2013 at 7:52 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
>>> It is interesting that this bug has stayed so long with us, which
>>> may indicate that nobody actually uses the feature at all.
>>
>> I don't know if people really care about whether
>> "refs/remotes/origin/HEAD" shortens to "origin/HEAD" or "origin". I'm
>> guessing that people _do_ depend on the reverse - having "origin"
>> expand into "refs/remotes/origin/HEAD", so we probably cannot rip out
>> the "refs/remotes/%.*s/HEAD" rule altogether...
>
> Oh, no doubt about that reverse conversion.
>
> The real reason nobody cared about refs/remotes/origin/HEAD is that
> nobody sane has anything but non-symbolic ref there.  Your t1514
> does this:
>
>         ...
>         git update-ref refs/master master_d &&
>         test_commit master_e

...oops, I see I forgot the trailing && on this line. Do you want a
resend, or fix up yourself?

>         git update-ref refs/remotes/origin/HEAD master_e &&
>         ...
>
> Nowhere in the set-up sequence, you see anything that does
>
>         git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/master
>
> or any other branch we copied from the remote.

Correct. I first did a "git remote set-head origin master", but
quickly discovered that rev-parse resolved the symref as part of
--abbrev-ref, so I had to fake up a non-symref to trigger the
shortening logic I wanted to test.

> And the shortening is done after dereferencing the symbolic ref.
> Because of this, refs/remotes/origin/HEAD usually resolves to
> origin/master, not origin.
>
>  t/t1514-rev-parse-shorten-unambiguous-ref.sh | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/t/t1514-rev-parse-shorten-unambiguous-ref.sh b/t/t1514-rev-parse-shorten-unambiguous-ref.sh
> index fd87ce3..556ad16 100755
> --- a/t/t1514-rev-parse-shorten-unambiguous-ref.sh
> +++ b/t/t1514-rev-parse-shorten-unambiguous-ref.sh
> @@ -76,4 +76,11 @@ test_expect_success 'shortening refnames in loose mode' '
>         test_shortname refs/tags/master loose tags/master master_c
>  '
>
> +test_expect_success 'shortening is done after dereferencing a symref' '
> +       git update-ref refs/remotes/frotz/master master_e &&
> +       git symbolic-ref refs/remotes/frotz/HEAD refs/remotes/frotz/master &&
> +       test_shortname refs/remotes/frotz/HEAD strict frotz/master master_e &&
> +       test_shortname refs/remotes/frotz/HEAD loose frotz/master master_e
> +'
> +
>  test_done

True. I'm not sure whether that's a feature or a bug in --abbrev-ref,
probably a feature.


...Johan

-- 
Johan Herland, <johan@xxxxxxxxxxx>
www.herland.net
--
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]