git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Stephen P. Smith" <ischis2@cox.net>
To: Git Mailing List <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>,
	Duy Nguyen <pclouds@gmail.com>, Will Palmer <wmpalmer@gmail.com>,
	"Stephen P . Smith" <ischis2@cox.net>
Subject: [PATCH V3 1/2] test for '!' handling in rev-parse's named commits
Date: Sat,  9 Jan 2016 19:22:29 -0700	[thread overview]
Message-ID: <1452392549-2656-1-git-send-email-ischis2@cox.net> (raw)
In-Reply-To: <1452392429-2578-1-git-send-email-ischis2@cox.net>

From: Will Palmer <wmpalmer@gmail.com>

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>
---

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

  reply	other threads:[~2016-01-10  2:22 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-06  0:24 [PATCH v2 0/2] specify commit by negative pattern Will Palmer
2015-06-06  0:24 ` [PATCH v2 1/2] test for '!' handling in rev-parse's named commits Will Palmer
2015-06-06  0:24 ` [PATCH v2 2/2] object name: introduce '^{/!-<negative pattern>}' notation Will Palmer
2015-06-08 16:39   ` Junio C Hamano
2015-06-09 18:14     ` Will Palmer
2015-10-28 17:52       ` Junio C Hamano
2016-01-08  6:04     ` [PATCH v2 2/2] object name: introduce '^{/!-<negativepattern>}' notation Stephen Smith
2016-01-08 18:21       ` Junio C Hamano
2016-01-10  2:20         ` [PATCH V3 0/2] specify commit by negative pattern Stephen P. Smith
2016-01-10  2:22           ` Stephen P. Smith [this message]
2016-01-10  2:23           ` [PATCH V3 2/2] object name: introduce '^{/!-<negative pattern>}' notation Stephen P. Smith
2016-01-11 18:10             ` Philip Oakley
2016-01-13  4:51               ` [PATCH V4 0/2] specify commit by negative pattern Stephen P. Smith
2016-01-13  4:51               ` [PATCH V4 1/2] test for '!' handling in rev-parse's named commits Stephen P. Smith
2016-01-13  4:52               ` [PATCH V4 2/2] object name: introduce '^{/!-<negative pattern>}' notation Stephen P. Smith
2016-01-13 19:15                 ` Junio C Hamano
2016-01-31  0:06                   ` [PATCH V5 " Stephen P. Smith
2016-02-01 21:42                     ` Junio C Hamano
2016-01-10 13:25           ` [PATCH V3 0/2] specify commit by negative pattern Philip Oakley
2016-01-11  0:08             ` Stephen P. Smith
2016-01-11 18:04               ` Philip Oakley
2016-01-10 14:14           ` Stephen & Linda Smith
2016-01-10 23:36             ` Philip Oakley
2016-01-09  1:55       ` [PATCH v2 2/2] object name: introduce '^{/!-<negativepattern>}' notation Stephen & Linda Smith
2016-01-09  2:18       ` Duy Nguyen
2016-01-11 17:13         ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452392549-2656-1-git-send-email-ischis2@cox.net \
    --to=ischis2@cox.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.com \
    --cc=wmpalmer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).