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

Re: [RFC] Using gitrevisions :/search style with other operators

From
Jakub Narebski <jnareb@gmail.com>
Date
Nov 10, 2010, 15:26 UTC
Message-ID
<m3eiatfbg2.fsf@localhost.localdomain>
In-Reply-To
<20101110084609.78f532a5@chalon.bertin.fr>
Yann Dirson <dirson@bertin.fr> writes:
Show 13 quoted lines
> On Tue, 09 Nov 2010 23:46:59 -0800
> Kevin Ballard <kevin@sb.org> wrote:
>> On Nov 9, 2010, at 11:32 PM, Yann Dirson wrote:
>> 
>>>> Another thing to consider - the current :/foo syntax searches for
>>>> the newest commit reachable from any ref. Using the ^{} syntax will
>>>> require specifying a ref first. I'm not sure this is a problem
>>>> though, as I'm not really sure why :/foo searches from all refs to
>>>> begin with.
>>> 
>>> The syntax could be extended so that ^{whatever} starts looking at
>>> current commit (ie. HEAD), somewhat like @{whatever} looks at
>>> reflog for current branch.

The <ref>@<sth> is about reflogs: <ref>@{<n>}, <ref>@{<aproxidate>}, @{-<n>}, <ref>@{upstream} / <ref>@{u}. Because HEAD has separate reflog, then @{<sth>} is about current branch reflog (@{-<n>} uses HEAD reflog, though). <ref> must be something that has reflog.

The <obj>^<sth> is about dereferencing: <tag>^{<objtype>} and <tag>^{}, which includes following parents <commit>^ and <commit>^<n>. Then there are odd <commit-ish>^! (returning range) and <commit-ish>^@ (all parents) but which nevertheless follow this rule.

The <obj>:<sth> is (with single exception of ':/<regexp>') about selecting subitem (path): <tree-ish>:<path>, [:<stage>]:<path>

Show 7 quoted lines
>> 
>> :/foo doesn't start from the current commit - it searches all refs.
>> However, making ^{} search all refs if not given one doesn't make
>> sense for any operator except :/foo, so I don't think it's worth doing
> 
> Yes, that's why I suggested to make it search from HEAD, not from all
> refs.
Perhaps '--all^{/foo}'?  Just kidding... I think ;-)

About n-th match: I think that ^{<n>/foo} or ^{:<n>/foo}... or ^{:nth(<n>)/foo} as generic form of e.g. ^{3rd/foo} a la Perl 6 :-) Or perhaps even full form ^{m:nth(<n>)/foo}... well, perhaps not.

-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: Yann DirsonNext: Nguyễn Thái Ngọc Duy
Message 9 of 21 in “Re: [RFC] Using gitrevisions :/search style with other operators”
  1. Yann DirsonNov 9, 2010
  2. Kevin BallardNov 9, 2010
  3. Yann DirsonNov 9, 2010
  4. Junio C HamanoNov 10, 2010
  5. Kevin BallardNov 10, 2010
  6. Yann DirsonNov 10, 2010
  7. Kevin BallardNov 10, 2010
  8. Yann DirsonNov 10, 2010
  9. Jakub NarebskiNov 10, 2010
  10. get_sha1: support relative path "<obj>:<sth>" syntaxNguyễn Thái Ngọc Duy, Nov 10, 2010
  11. Matthieu MoyNov 10, 2010
  12. Jonathan NiederNov 10, 2010
  13. Nguyen Thai Ngoc DuyNov 11, 2010
  14. Junio C HamanoNov 10, 2010
  15. Nguyen Thai Ngoc DuyNov 11, 2010
  16. Junio C HamanoDec 9, 2010
  17. Junio C HamanoDec 9, 2010
  18. Nguyen Thai Ngoc DuyDec 10, 2010
  19. Junio C HamanoNov 10, 2010
  20. Jakub NarebskiNov 10, 2010
  21. Jeff KingNov 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.