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

[PATCH V3 0/2] specify commit by negative pattern

From
SSStephen P. Smith <ischis2@cox.net>
Date
Jan 11, 2016, 00:08 UTC
Message-ID
<1452470880-8753-1-git-send-email-ischis2@cox.net>
In-Reply-To
<87DF51336FE74635921A8C6857125F8B@PhilipOakley>

Add support for negative pattern matching in @^{/<pattern>} style revision specifiers. So now you can find the first commit whose message doesn't match a pattern, complementing the existing positive matching. e.g.:

    $ git rebase -i @^{/!-^WIP}

My use-case is in having a "work, work, work, rebase, push"-style workflow, which generates a lot of "WIP foo" commits. While rebasing is usually handled via "git rebase -i origin/master", occasionally I will already have several "good, but not yet ready to push" commits hanging around while I finish work on related commits. In these situations, the ability to quickly "git diff @^{/!-^WIP}" to get an overview of all changes "since the last one I was happy with", can be useful.

This is the second version of the patch series. The previous attempt used the notation @^{/!WIP}, rather than @^{/!-WIP}, so the "modifier" was the '!' character. Now, '!' is taken as an indicator that the pattern is to be interpreted differently, and '-' is taken as an indicator of how it is to be interpreted differently. This follows recent discussion with "Junio C Hamano" <gitster@pobox.com> and much-less recent discussion archived at:

http://thread.gmane.org/gmane.comp.version-control.git/40460/focus=40477

In summary, '!' is to be used as an "escape hatch", for further extension of the "name commit by pattern" functionality. Theorised future extensions indicated things like "what was to be searched", e.g.: @^{/!(a=author)}. With only two interpretations of the '!' leader, for now (including the '!!' literal notation), adding such a verbose form, such as '@^{/!(negative)foo}', seemed inappropriate at this time. In the event that such verbose forms are ever implemented, this new form may act as a shorthand, for a basic case.

Will Palmer (2):
  test for '!' handling in rev-parse's named commits
  object name: introduce '^{/!-<negative pattern>}' notation
 Documentation/revisions.txt | 11 +++++-----
 sha1_name.c                 | 20 ++++++++++++-----
 t/t1511-rev-parse-caret.sh  | 53 ++++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 73 insertions(+), 11 deletions(-)
-- 
2.7.0-rc2
Previous: Philip OakleyNext: Philip Oakley
Message 20 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.