Skip to content

Commit 06b6b68

Browse files
wpalmergitster
authored andcommitted
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>
1 parent 3d4a3ff commit 06b6b68

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

t/t1511-rev-parse-caret.sh

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@ test_expect_success 'setup' '
1818
git checkout master &&
1919
echo modified >>a-blob &&
2020
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
2230
'
2331

2432
test_expect_success 'ref^{non-existent}' '
@@ -77,4 +85,18 @@ test_expect_success 'ref^{/Initial}' '
7785
test_cmp expected actual
7886
'
7987

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+
80102
test_done

0 commit comments

Comments
 (0)