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

Re: [PATCH 0/2] [RFD] Using gitrevisions :/search style with other operators

From
Jakub Narebski <jnareb@gmail.com>
Date
Dec 9, 2010, 11:38 UTC
Message-ID
<201012091238.15685.jnareb@gmail.com>
In-Reply-To
<7vsjy7h3db.fsf@alter.siamese.dyndns.org>
On Thu, 9 Dec 2010, Junio C Hamano wrote:
Show 18 quoted lines
> Jonathan Nieder <jrnieder@gmail.com> writes:
>> Jakub Narebski wrote:
>>
>>> You would need HEAD{^{/foo}^@}x3, or use special rule that HEAD^{/foo}x2
>>> means really HEAD^{/foo}^@^{/foo}, with ^@ used to join them.
>>
>> That said, does ^2x500 really do something meaningful that a person
>> would ever need?  I like the
>>
>> 	^{:nth(3)/foo}
>>
>> syntax because perl6 supports m:nth(3)/foo/, suggesting a menu of
>> already-defined modifiers to implement when they prove useful,...
> 
> Can you explain what the colon in "$commit^{:nth(3)/foo}" is doing?  
> 
> Are we declaring anything that begins with ':' is a magic inside ^{...}
> construct?
The idea is to follow Perl 6 rule of combining modifiers "Every modifier
must start with its own colon."
  http://perlcabal.org/syn/S05.html#Modifiers
This allow for easy combining modifiers without introducing special rules,
for example ^{:g:i/foo} would return all matches (:g == :global) instead
of only the first, ignoring case (:i == :ignorecase).
 
Show 5 quoted lines
> I do not think nth($n) without specifying where to start (iow, what the
> current ":/foo" implementation does but with "three levels deep") makes
> any sense, but because the main point of your argument is that we can have
> modifies other than nth($n) that may make sense in such a context, I would
> want to make sure anything we come up with is extensible to that syntax.

Hmmm... I haven't thought about it. I guess that ^{:nth(N)/foo} should return Nth element in the list that ^{:g/foo} / --grep=foo would return.

This way one could use
  $ git log pu@{1}..pu --merges --grep="Merge branch 'nd/"
to find all new Nguyen contributions in 'pu', and
  $ git log pu..pu^{:2nd/Merge branch 'nd/}^2
to view 2nd (2nd == nth(2)) such branch on the list.
Show 5 quoted lines
> 
> On the "starting from any ref" front, I think "!" (as in ":/!some magic")
> was the introducer we reserved for such a magic some time ago, so perhaps
> on the "starting from this commit" side, "^{!magic/foo}" may be more
> appropriate?

I'd like to deprecate ":/foo" in favor of "--all ^{/foo}", or even special case it to "^{/foo}" (if not attached to ref, ^{(:<modifier>)*/<regexp>} acts on positive revs replacing them).

But ^{/foo} might be overengineered...
-- 
Jakub Narebski
Poland
Previous: Junio C HamanoNext: Nguyen Thai Ngoc Duy
Message 15 of 32 in “[RFD] Using gitrevisions :/search style with other operators”
  1. 0/2 [RFD] Using gitrevisions :/search style with other operatorsNguyễn Thái Ngọc Duy, Dec 8, 2010
  2. 1/2 get_sha1_oneline: allow to input commit_listNguyễn Thái Ngọc Duy, Dec 8, 2010
  3. Thiago FarinaDec 8, 2010
  4. 2/2 get_sha1: support ref^{/regex} syntaxNguyễn Thái Ngọc Duy, Dec 8, 2010
  5. Junio C HamanoDec 8, 2010
  6. Jonathan NiederDec 8, 2010
  7. Jakub NarebskiDec 8, 2010
  8. Nguyen Thai Ngoc DuyDec 9, 2010
  9. Jakub NarebskiDec 9, 2010
  10. Jonathan NiederDec 9, 2010
  11. Kevin BallardDec 9, 2010
  12. Nguyen Thai Ngoc DuyDec 9, 2010
  13. Jonathan NiederDec 9, 2010
  14. Junio C HamanoDec 9, 2010
  15. Jakub NarebskiDec 9, 2010
  16. Nguyen Thai Ngoc DuyDec 10, 2010
  17. Jonathan NiederDec 10, 2010
  18. Jakub NarebskiDec 10, 2010
  19. Kevin BallardDec 10, 2010
  20. Jeff KingDec 10, 2010
  21. Junio C HamanoDec 10, 2010
  22. Kevin BallardDec 10, 2010
  23. Junio C HamanoDec 10, 2010
  24. Junio C HamanoDec 9, 2010
  25. Jakub NarebskiDec 8, 2010
  26. Jonathan NiederDec 8, 2010
  27. Nguyen Thai Ngoc DuyDec 9, 2010
  28. Jakub NarebskiDec 9, 2010
  29. Nguyen Thai Ngoc DuyDec 9, 2010
  30. Kevin BallardDec 9, 2010
  31. Jakub NarebskiDec 9, 2010
  32. Nguyen Thai Ngoc DuyDec 9, 2010

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.