Skip to content

Commit

Permalink
test for '!' handling in rev-parse's named commits
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
wpalmer authored and gitster committed Jan 11, 2016
1 parent 3d4a3ff commit 06b6b68
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion t/t1511-rev-parse-caret.sh
Expand Up @@ -18,7 +18,15 @@ test_expect_success 'setup' '
git checkout master &&
echo modified >>a-blob &&
git add -u &&
git commit -m Modified
git commit -m Modified &&
git branch modref &&
echo changed! >>a-blob &&
git add -u &&
git commit -m !Exp &&
git branch expref &&
echo changed >>a-blob &&
git add -u &&
git commit -m Changed
'

test_expect_success 'ref^{non-existent}' '
Expand Down Expand Up @@ -77,4 +85,18 @@ test_expect_success 'ref^{/Initial}' '
test_cmp expected actual
'

test_expect_success 'ref^{/!Exp}' '
test_must_fail git rev-parse master^{/!Exp}
'

test_expect_success 'ref^{/!}' '
test_must_fail git rev-parse master^{/!}
'

test_expect_success 'ref^{/!!Exp}' '
git rev-parse expref >expected &&
git rev-parse master^{/!!Exp} >actual &&
test_cmp expected actual
'

test_done

0 comments on commit 06b6b68

Please sign in to comment.