Re: [PATCH] Add new @ shortcut for HEAD
From: Felipe Contreras <hidden>
Date: 2016-06-15 22:57:04
On Mon, Apr 29, 2013 at 5:38 PM, Junio C Hamano [off-list ref] wrote:
Felipe Contreras [off-list ref] writes:quoted
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.
Otherwise we wouldn't notice a
breakage because we cannot tell if HEAD@ and master@ are interpreted
correctly or all of these happen to yield $HASH4 because a version
somebody else patches to break the implementation in this patch
discards any string before @ that is not followed by {stuff}.
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" &&
+ test_must_fail git rev-parse --verify foo@
--
Felipe Contreras