Re: [PATCH v2] remote: make refspec follow the same disambiguation rule as local refs
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 1, 2018, 18:26 UTC
- Message-ID
- <xmqqo9em6j0a.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20180801181348.106679-1-jonathantanmy@google.com>
Jonathan Tan <jonathantanmy@google.com> writes:
Show 37 quoted lines
>> +test_expect_success 'LHS of refspec follows ref disambiguation rules' '
>> + mkdir lhs-ambiguous &&
>> + (
>> + cd lhs-ambiguous &&
>> + git init server &&
>> + test_commit -C server unwanted &&
>> + test_commit -C server wanted &&
>> +
>> + git init client &&
>> +
>> + # Check a name coming after "refs" alphabetically ...
>> + git -C server update-ref refs/heads/s wanted &&
>> + git -C server update-ref refs/heads/refs/heads/s unwanted &&
>> + git -C client fetch ../server +refs/heads/s:refs/heads/checkthis &&
>> + git -C server rev-parse wanted >expect &&
>> + git -C client rev-parse checkthis >actual &&
>> + test_cmp expect actual &&
>> +
>> + # ... and one before.
>> + git -C server update-ref refs/heads/q wanted &&
>> + git -C server update-ref refs/heads/refs/heads/q unwanted &&
>> + git -C client fetch ../server +refs/heads/q:refs/heads/checkthis &&
>> + git -C server rev-parse wanted >expect &&
>> + git -C client rev-parse checkthis >actual &&
>> + test_cmp expect actual &&
>> +
>> + # Tags are preferred over branches like refs/{heads,tags}/*
>> + git -C server update-ref refs/tags/t wanted &&
>> + git -C server update-ref refs/heads/t unwanted &&
>> + git -C client fetch ../server +t:refs/heads/checkthis &&
>> + git -C server rev-parse wanted >expect &&
>> + git -C client rev-parse checkthis >actual
>> + )
>> +'
>
> Thanks, this looks good to me. Also thanks for adding the "+" in the
> fetch commands in the test.Yup, otherwise the fetch may fail because "checkthis" may have to be rewound when we fetch different things.