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

Re: [RFC/PATCH] tag: make list exclude !<pattern>

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Feb 11, 2012, 07:50 UTC
Message-ID
<4F361DD4.9020108@alum.mit.edu>
In-Reply-To
<7vaa4qnk4u.fsf@alter.siamese.dyndns.org>
On 02/11/2012 04:06 AM, Junio C Hamano wrote:
Show 13 quoted lines
> Tom Grennan <tmgrennan@gmail.com> writes:
>> The following series implements !<pattern> with: git-tag, git-branch, and
>> git-for-each-ref.
>>
>> This still requires Documentation and unit test updates but I think these are
>> close to functionally complete.
>
> Do we allow a refname whose pathname component begins with '!', by the
> way?  If we do, how does a user look for a tag whose name is "!xyzzy"?
> "Naming your tag !xyzzy used to be allowed but it is now forbidden after
> this patch" is not an acceptable answer---it is called a regression.  If
> the negation operator were "^" or something that we explicitly forbid from
> a refname, we wouldn't have such a problem.

According to git-check-ref-format(1), '!' are allowed in reference names. (Whether that was a good idea is another question, but now we have to support it.)

So using "^" would be an option. A problem is that the new meaning is not consistent with the use of "^" in rev-list, and therefore would (1) be confusing and (2) prevent the addition of a similar syntax in rev-list.

Currently,
    git rev-list A B ^C
means "revisions reachable from A or B but not from C".  (For simplicity
assume that A, B, and C are literal reference names without wildcards.)
 The proposal, amended to use "^" instead of "!", is that
    git for-each-ref A B ^C
should mean "the reference names A and B but not C".  Therefore, the command
    git rev-list $(git for-each-ref A B ^C)

, which consistency suggests should do the same thing as the first command, would in fact be equivalent to

    git rev-list A B

Moreover, it *would* be nice to have this kind of exclude-branch-name syntax in rev-parse. Many times I have wanted to type the equivalent of

    gitk --all --not-branch=remotes/korg/*

That is, "show the commits starting at *all branches except for the specified branches*". This is different than "show *the commits starting at all branches* except for *the commits reachable from the specified branches*", because I want to see the *complete* history of the non-excluded branches. (Is there an easy way to do this now?) The proposed functionality is a step forward; I could type

    gitk $(git for-each-ref !remotes/korg/*)
But it would be even nicer if this could be expressed directly in rev-parse.

In summary, I suggest we consider using a more verbose syntax for this new functionality (probably via one or more new options, for example --not-branch=PATTERN, --not-tag=PATTERN, and/or --not-ref=PATTERN) that cannot be confused with the existing syntax for excluding commits.

Michael
-- 
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
Previous: Tom GrennanNext: Junio C Hamano
Message 25 of 83 in “tag: make list exclude !<pattern>”
  1. tag: make list exclude !<pattern>Tom Grennan, Feb 9, 2012
  2. tag: make list exclude !<pattern>Tom Grennan, Feb 9, 2012
  3. Tom GrennanFeb 10, 2012
  4. Nguyen Thai Ngoc DuyFeb 10, 2012
  5. Tom GrennanFeb 10, 2012
  6. Tom GrennanFeb 11, 2012
  7. 1/4 refs: add common refname_match_patterns()Tom Grennan, Feb 11, 2012
  8. Michael HaggertyFeb 11, 2012
  9. Tom GrennanFeb 11, 2012
  10. Michael HaggertyFeb 13, 2012
  11. Tom GrennanFeb 13, 2012
  12. Junio C HamanoFeb 11, 2012
  13. Tom GrennanFeb 11, 2012
  14. Junio C HamanoFeb 11, 2012
  15. Tom GrennanFeb 13, 2012
  16. 2/4 tag: use refs.c:refname_match_patterns()Tom Grennan, Feb 11, 2012
  17. 3/4 branch: use refs.c:refname_match_patterns()Tom Grennan, Feb 11, 2012
  18. 4/4 for-each-ref: use refs.c:refname_match_patterns()Tom Grennan, Feb 11, 2012
  19. Junio C HamanoFeb 11, 2012
  20. Junio C HamanoFeb 11, 2012
  21. Jakub NarebskiFeb 11, 2012
  22. Nguyen Thai Ngoc DuyFeb 11, 2012
  23. Junio C HamanoFeb 11, 2012
  24. Tom GrennanFeb 11, 2012
  25. Michael HaggertyFeb 11, 2012
  26. Junio C HamanoFeb 11, 2012
  27. Michael HaggertyFeb 13, 2012
  28. Junio C HamanoFeb 13, 2012
  29. Michael HaggertyFeb 13, 2012
  30. Junio C HamanoFeb 13, 2012
  31. Michael HaggertyFeb 13, 2012
  32. Junio C HamanoFeb 13, 2012
  33. Tom GrennanFeb 11, 2012
  34. 0/5 Re: tag: make list exclude !<pattern>Tom Grennan, Feb 22, 2012
  35. 1/5 refs: add match_pattern()Tom Grennan, Feb 22, 2012
  36. Junio C HamanoFeb 22, 2012
  37. Tom GrennanFeb 22, 2012
  38. Junio C HamanoFeb 23, 2012
  39. Tom GrennanFeb 23, 2012
  40. 2/5 tag --points-at option wrapperTom Grennan, Feb 22, 2012
  41. 3/5 tag --exclude optionTom Grennan, Feb 22, 2012
  42. Junio C HamanoFeb 22, 2012
  43. Tom GrennanFeb 23, 2012
  44. Junio C HamanoFeb 23, 2012
  45. 0/5 modernize test styleTom Grennan, Mar 1, 2012
  46. 1/5 t6300 (for-each-ref): modernize styleTom Grennan, Mar 1, 2012
  47. Johannes SixtMar 1, 2012
  48. Tom GrennanMar 1, 2012
  49. 2/5 t5512 (ls-remote): modernize styleTom Grennan, Mar 1, 2012
  50. Thomas RastMar 1, 2012
  51. 3/5 t3200 (branch): modernize styleTom Grennan, Mar 1, 2012
  52. 4/5 t0040 (parse-options): modernize styleTom Grennan, Mar 1, 2012
  53. 5/5 t7004 (tag): modernize styleTom Grennan, Mar 1, 2012
  54. 101/105 t6300 (for-each-ref): modernize styleTom Grennan, Mar 1, 2012
  55. Junio C HamanoMar 1, 2012
  56. Tom GrennanMar 1, 2012
  57. Junio C HamanoMar 1, 2012
  58. Tom GrennanMar 1, 2012
  59. Tom GrennanMar 1, 2012
  60. Thomas RastMar 1, 2012
  61. Tom GrennanMar 1, 2012
  62. 102/105 t5512 (ls-remote): modernize styleTom Grennan, Mar 1, 2012
  63. 103/105 t3200 (branch): modernize styleTom Grennan, Mar 1, 2012
  64. 104/105 t0040 (parse-options): modernize styleTom Grennan, Mar 1, 2012
  65. 105/105 t7004 (tag): modernize styleTom Grennan, Mar 1, 2012
  66. 0/5 modernize test styleTom Grennan, Mar 3, 2012
  67. 1/5 t7004 (tag): modernize styleTom Grennan, Mar 3, 2012
  68. Johannes SixtMar 3, 2012
  69. 2/5 t5512 (ls-remote): modernize styleTom Grennan, Mar 3, 2012
  70. Junio C HamanoMar 3, 2012
  71. Tom GrennanMar 3, 2012
  72. 3/5 t3200 (branch): modernize styleTom Grennan, Mar 3, 2012
  73. 4/5 t0040 (parse-options): modernize styleTom Grennan, Mar 3, 2012
  74. 5/5 t6300 (for-each-ref): modernize styleTom Grennan, Mar 3, 2012
  75. 101/105 t7004 (tag): modernize styleTom Grennan, Mar 3, 2012
  76. 102/105 t5512 (ls-remote): modernize styleTom Grennan, Mar 3, 2012
  77. 103/105 t3200 (branch): modernize styleTom Grennan, Mar 3, 2012
  78. 104/105 t0040 (parse-options): modernize styleTom Grennan, Mar 3, 2012
  79. 105/105 t6300 (for-each-ref): modernize styleTom Grennan, Mar 3, 2012
  80. Junio C HamanoMar 3, 2012
  81. Tom GrennanMar 3, 2012
  82. 4/5 branch --exclude optionTom Grennan, Feb 22, 2012
  83. 5/5 for-each-ref --exclude optionTom Grennan, Feb 22, 2012

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.