summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Palmer <wmpalmer@gmail.com>2016-01-09 19:22:29 -0700
committerJunio C Hamano <gitster@pobox.com>2016-01-11 10:44:13 -0800
commit06b6b68ff943de9e5c2f537807c054cd536731d1 (patch)
tree465dcced931a8d4f8a944e4e4855ecc38b6622ec
parent3d4a3ffe64162b45ae7c991fc60623ecb4678cfd (diff)
downloadgit-06b6b68ff943de9e5c2f537807c054cd536731d1.tar.gz
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>
-rwxr-xr-xt/t1511-rev-parse-caret.sh24
1 files changed, 23 insertions, 1 deletions
diff --git a/t/t1511-rev-parse-caret.sh b/t/t1511-rev-parse-caret.sh
index 15973f2094..b2f90bea6a 100755
--- a/t/t1511-rev-parse-caret.sh
+++ b/t/t1511-rev-parse-caret.sh
@@ -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}' '
@@ -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