test for '!' handling in rev-parse's named commits
In anticipation of extending this behaviour, add tests verifying the handling of exclamation marks when looking up a commit "by name". Specifically, as documented: '<rev>^{/!Message}' should fail, as the '!' prefix is reserved; while '<rev>^{!!Message}' should search for a commit whose message contains the string "!Message". Signed-off-by: Will Palmer <wmpalmer@gmail.com> Signed-off-by: Stephen P. Smith <ischis2@cox.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Will Palmer committed
Jan 9, 2016 at 19:22 UTC
06b6b68ff943de9e5c2f537807c054cd536731d1
1 file changed
+23
-1
t/t1511-rev-parse-caret.sh
+23
-1
@@ -18,7 +18,15 @@ test_expect_success 'setup' '
18
git checkout master &&
19
echo modified >>a-blob &&
20
git add -u &&
21
- git commit -m Modified
21
+ git commit -m Modified &&
22
+ git branch modref &&
23
+ echo changed! >>a-blob &&
24
+ git add -u &&
25
+ git commit -m !Exp &&
26
+ git branch expref &&
27
+ echo changed >>a-blob &&
28
+ git add -u &&
29
+ git commit -m Changed
30
'
31
32
test_expect_success 'ref^{non-existent}' '
@@ -77,4 +85,18 @@ test_expect_success 'ref^{/Initial}' '
85
test_cmp expected actual
86
'
87
88
+test_expect_success 'ref^{/!Exp}' '
89
+ test_must_fail git rev-parse master^{/!Exp}
90
+'
91
+
92
+test_expect_success 'ref^{/!}' '
93
+ test_must_fail git rev-parse master^{/!}
94
+'
95
+
96
+test_expect_success 'ref^{/!!Exp}' '
97
+ git rev-parse expref >expected &&
98
+ git rev-parse master^{/!!Exp} >actual &&
99
+ test_cmp expected actual
100
+'
101
+
102
test_done