From: Will Palmer <wmpalmer@xxxxxxxxx> 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@xxxxxxxxx> Signed-off-by: Stephen P. Smith <ischis2@xxxxxxx> --- Notes: Moved modref branch from 2/2 to the 1/2 patch as discussed in [1] and [2]. In [3] the suggestion was made to change ^{!/... to ^{/!. The comment notes that anything after { is reserved and can be used. The v2 commit mesage (which has been retained) noted that !Message should fail as '!' is reserved where !!Message should search for a string that contains !Message. Because of the commit note, I chose not to make the change from ^{!/... to ^{/!.. [1] http://article.gmane.org/gmane.comp.version-control.git/271071 [2] http://article.gmane.org/gmane.comp.version-control.git/283573 [3] http://article.gmane.org/gmane.comp.version-control.git/283597 t/t1511-rev-parse-caret.sh | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/t/t1511-rev-parse-caret.sh b/t/t1511-rev-parse-caret.sh index 15973f2..b2f90be 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 -- 2.7.0-rc2 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html