Re: [PATCH] Add new @ shortcut for HEAD

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] Add new @ shortcut for HEAD

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:57:04

Felipe Contreras [off-list ref] writes:
quoted hunk
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?  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}.

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help