From: Jakub Narebski Date: Wed, 10 Nov 2010 15:26:20 GMT Subject: Re: [RFC] Using gitrevisions :/search style with other operators Message-ID: In-Reply-To: <20101110084609.78f532a5@chalon.bertin.fr> Yann Dirson writes: > On Tue, 09 Nov 2010 23:46:59 -0800 > Kevin Ballard 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 @ is about reflogs: @{}, @{}, @{-}, @{upstream} / @{u}. Because HEAD has separate reflog, then @{} is about current branch reflog (@{-} uses HEAD reflog, though). must be something that has reflog. The ^ is about dereferencing: ^{} and ^{}, which includes following parents ^ and ^. Then there are odd ^! (returning range) and ^@ (all parents) but which nevertheless follow this rule. The : is (with single exception of ':/') about selecting subitem (path): :, [:]: >> >> :/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 ^{/foo} or ^{:/foo}... or ^{:nth()/foo} as generic form of e.g. ^{3rd/foo} a la Perl 6 :-) Or perhaps even full form ^{m:nth()/foo}... well, perhaps not. -- Jakub Narebski Poland ShadeHawk on #git