Re: [PATCH] Add new @ shortcut for HEAD

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

 



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@xxxxxxxxx> writes:

> On Mon, Apr 29, 2013 at 5:38 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
>> Felipe Contreras <felipe.contreras@xxxxxxxxx> 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
--
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]