Re: [PATCH v2 2/2] object name: introduce '^{/!-<negative pattern>}' notation
From: Junio C Hamano <hidden>
Date: 2016-06-15 23:05:12
Will Palmer [off-list ref] writes:
- * For future extension, ':/!' is reserved. If you want to match a message - * beginning with a '!', you have to repeat the exclamation mark. + * For negative-matching, prefix the pattern-part with '!-', like: ':/!-WIP'. + * + * For a literal '!' character at the beginning of a pattern, you have to repeat + * that, like: ':/!!foo' + * + * For future extension, all other sequences beginning with ':/!' are reserved. */
Good.
quoted hunk
diff --git a/t/t1511-rev-parse-caret.sh b/t/t1511-rev-parse-caret.sh index e0fe102..8a5983f 100755 --- a/t/t1511-rev-parse-caret.sh +++ b/t/t1511-rev-parse-caret.sh@@ -19,13 +19,17 @@ test_expect_success 'setup' ' echo modified >>a-blob && git add -u && git commit -m Modified && + git branch modref &&
This probably belongs to the previous step, no?
+test_expect_success 'ref^{/!-}' '
+ test_must_fail git rev-parse master^{/!-}
+'Hmmmm, we must fail because...? We are looking for something that does not contain an empty string, which by definition does not exist. Funny, but is correct ;-).
+test_expect_success 'ref^{/!-.}' '
+ test_must_fail git rev-parse master^{/!-.}
+'Likewise. I however wonder if we catch a commit without any message (which you probably have to craft with either commit-tree or hash-object), but that falls into the "curiosity" not the "practicality" category.
+test_expect_success 'ref^{/!-non-existent}' '
+ git rev-parse master >expected &&
+ git rev-parse master^{/!-non-existent} >actual &&
+ test_cmp expected actual
+'OK.
+test_expect_success 'ref^{/!-Changed}' '
+ git rev-parse expref >expected &&
+ git rev-parse master^{/!-Changed} >actual &&
+ test_cmp expected actual
+'OK.
+test_expect_success 'ref^{/!-!Exp}' '
+ git rev-parse modref >expected &&
+ git rev-parse expref^{/!-!Exp} >actual &&
+ test_cmp expected actual
+'OK.
test_done