git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 2/2] object name: introduce '^{/!-<negative pattern>}' notation

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 8, 2015, 16:39 UTC
Message-ID
<xmqqbngqcfxd.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1433550295-15098-3-git-send-email-wmpalmer@gmail.com>
Will Palmer <wmpalmer@gmail.com> writes:
Show 9 quoted lines
> - * 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.
Show 9 quoted lines
> 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.

Show 5 quoted lines
> +test_expect_success 'ref^{/!-non-existent}' '
> +	git rev-parse master >expected &&
> +	git rev-parse master^{/!-non-existent} >actual &&
> +	test_cmp expected actual
> +'
OK.
Show 5 quoted lines
> +test_expect_success 'ref^{/!-Changed}' '
> +	git rev-parse expref >expected &&
> +	git rev-parse master^{/!-Changed} >actual &&
> +	test_cmp expected actual
> +'
OK.
Show 5 quoted lines
> +test_expect_success 'ref^{/!-!Exp}' '
> +	git rev-parse modref >expected &&
> +	git rev-parse expref^{/!-!Exp} >actual &&
> +	test_cmp expected actual
> +'
OK.
>  test_done
Previous: Will PalmerNext: Will Palmer
Message 4 of 26 in “specify commit by negative pattern”
  1. 0/2 specify commit by negative patternWill Palmer, Jun 6, 2015
  2. 1/2 test for '!' handling in rev-parse's named commitsWill Palmer, Jun 6, 2015
  3. 2/2 object name: introduce '^{/!-<negative pattern>}' notationWill Palmer, Jun 6, 2015
  4. Junio C HamanoJun 8, 2015
  5. Will PalmerJun 9, 2015
  6. Junio C HamanoOct 28, 2015
  7. Stephen SmithJan 8, 2016
  8. Junio C HamanoJan 8, 2016
  9. 0/2 specify commit by negative patternStephen P. Smith, Jan 10, 2016
  10. 1/2 test for '!' handling in rev-parse's named commitsStephen P. Smith, Jan 10, 2016
  11. 2/2 object name: introduce '^{/!-<negative pattern>}' notationStephen P. Smith, Jan 10, 2016
  12. Philip OakleyJan 11, 2016
  13. 0/2 specify commit by negative patternStephen P. Smith, Jan 13, 2016
  14. 1/2 test for '!' handling in rev-parse's named commitsStephen P. Smith, Jan 13, 2016
  15. 2/2 object name: introduce '^{/!-<negative pattern>}' notationStephen P. Smith, Jan 13, 2016
  16. Junio C HamanoJan 13, 2016
  17. 2/2 object name: introduce '^{/!-<negative pattern>}' notationStephen P. Smith, Jan 31, 2016
  18. Junio C HamanoFeb 1, 2016
  19. Philip OakleyJan 10, 2016
  20. 0/2 specify commit by negative patternStephen P. Smith, Jan 11, 2016
  21. Philip OakleyJan 11, 2016
  22. Stephen & Linda SmithJan 10, 2016
  23. Philip OakleyJan 10, 2016
  24. Stephen & Linda SmithJan 9, 2016
  25. Duy NguyenJan 9, 2016
  26. Junio C HamanoJan 11, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.