public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Will Palmer <wmpalmer@gmail•com>
Cc: git@vger•kernel.org
Subject: Re: [PATCH v2 2/2] object name: introduce '^{/!-<negative pattern>}' notation
Date: Mon, 08 Jun 2015 09:39:58 -0700	[thread overview]
Message-ID: <xmqqbngqcfxd.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1433550295-15098-3-git-send-email-wmpalmer@gmail.com> (Will Palmer's message of "Sat, 6 Jun 2015 01:24:55 +0100")

Will Palmer <wmpalmer@gmail•com> writes:

> - * For future extension, ':/!' is reserved. If you want to match a message
> - * beginning with a '!', you have to repeat the exclamation mark.
> + * For negative-matching, prefix the pattern-part with '!-', like: ':/!-WIP'.
> + *
> + * For a literal '!' character at the beginning of a pattern, you have to repeat
> + * that, like: ':/!!foo'
> + *
> + * For future extension, all other sequences beginning with ':/!' are reserved.
>   */

Good.

> diff --git a/t/t1511-rev-parse-caret.sh b/t/t1511-rev-parse-caret.sh
> index e0fe102..8a5983f 100755
> --- a/t/t1511-rev-parse-caret.sh
> +++ b/t/t1511-rev-parse-caret.sh
> @@ -19,13 +19,17 @@ test_expect_success 'setup' '
>  	echo modified >>a-blob &&
>  	git add -u &&
>  	git commit -m Modified &&
> +	git branch modref &&

This probably belongs to the previous step, no?

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

Hmmmm, we must fail because...?  We are looking for something that
does not contain an empty string, which by definition does not
exist.

Funny, but is correct ;-).


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

Likewise.  I however wonder if we catch a commit without any message
(which you probably have to craft with either commit-tree or
hash-object), but that falls into the "curiosity" not the
"practicality" category.

> +test_expect_success 'ref^{/!-non-existent}' '
> +	git rev-parse master >expected &&
> +	git rev-parse master^{/!-non-existent} >actual &&
> +	test_cmp expected actual
> +'

OK.

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

OK.

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

OK.

>  test_done

  reply	other threads:[~2015-06-08 16:40 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 [this message]
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           ` [PATCH V3 1/2] test for '!' handling in rev-parse's named commits Stephen P. Smith
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=xmqqbngqcfxd.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=wmpalmer@gmail$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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