Re: [PATCH] Add new @ shortcut for HEAD
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Apr 29, 2013, 23:06 UTC
- Message-ID
- <7vobcxey3g.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <CAMP44s2iTBW3P25RCDQCoM02K1JTs9v6-8SG91MJeUxh4b1qEQ@mail.gmail.com>
The following message is a courtesy copy of an article that has been posted to gmane.comp.version-control.git as well.
Felipe Contreras <felipe.contreras@gmail.com> writes:
Show 24 quoted lines
> On Mon, Apr 29, 2013 at 5:38 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Felipe Contreras <felipe.contreras@gmail.com> writes:
>>
>>> diff --git a/t/t1503-rev-parse-verify.sh b/t/t1503-rev-parse-verify.sh
>>> index 813cc1b..426c63f 100755
>>> --- a/t/t1503-rev-parse-verify.sh
>>> +++ b/t/t1503-rev-parse-verify.sh
>>> @@ -115,4 +115,13 @@ test_expect_success 'master@{n} for various n' '
>>> test_must_fail git rev-parse --verify master@{$Np1}
>>> '
>>>
>>> +test_expect_success 'empty @' '
>>> + rev_hash=$(git rev-parse --verify @) &&
>>> + test "$rev_hash" = "$HASH4" &&
>>> + rev_hash=$(git rev-parse --verify HEAD@) &&
>>> + test "$rev_hash" = "$HASH4" &&
>>> + rev_hash=$(git rev-parse --verify master@) &&
>>> + test "$rev_hash" = "$HASH4"
>>> +'
>>
>> Don't we have different refs that resolve to something other than
>> $HASH4 at this point in the test?
>
> No.Of course we're free to make some as needed; perhaps like this?
t/t1503-rev-parse-verify.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/t/t1503-rev-parse-verify.sh b/t/t1503-rev-parse-verify.sh index 426c63f..f8f3b34 100755 --- a/t/t1503-rev-parse-verify.sh +++ b/t/t1503-rev-parse-verify.sh @@ -115,13 +115,18 @@ test_expect_success 'master@{n} for various n' ' test_must_fail git rev-parse --verify master@{$Np1} ' -test_expect_success 'empty @' ' +test_expect_success 'empty @ and ref@ without trailing {stuff}' ' + test_when_finished "git branch -d twoago" && + git branch twoago HEAD~2 && rev_hash=$(git rev-parse --verify @) && test "$rev_hash" = "$HASH4" && rev_hash=$(git rev-parse --verify HEAD@) && test "$rev_hash" = "$HASH4" && rev_hash=$(git rev-parse --verify master@) && - test "$rev_hash" = "$HASH4" + test "$rev_hash" = "$HASH4" && + rev_hash=$(git rev-parse --verify twoago@) && + test "$rev_hash" = "$HASH2" && + test_must_fail git rev-parse --verify nosuch@ ' test_done