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

From: Jakub Narebski <[email-masked]>
Date: Thu, 9 Dec 2010 02:54:23 +0100

Nguyen Thai Ngoc Duy wrote:
> On Thu, Dec 9, 2010 at 2:51 AM, Jakub Narebski <[email-masked]> wrote:
>> Dnia środa 8. grudnia 2010 19:06, Jonathan Nieder napisał:
>>> Nguyễn Thái Ngọc Duy wrote:
>>>
>>>> Let's start off from where the previous discussion [1] stopped. People
>>>> seem to agree ref^{/regex} is a good choice. But we have not come to
>>>> conclusion how to specify the count yet. Possible suggestions are
>>>>
>>>>  - ref^{/foo}2
>>>>  - ref^{2/foo}
>>>>  - ref^{:2/foo}
>>>>  - ref^{2nd/foo}
>>>
>>> How about
>>>
>>>       ref^{/foo}^^{/foo}
>>>
>>> ?
>>
>> I'll assume that there is invisible ";)" emoticon here.
>>
>>
>> First, it would be ref^{/foo}^@^{/foo}, otherwise you would follow only
>> first parent.
>>
>> Second, consider ref^{:nth(10)/foo} in your workaround...
> 
> Maybe we should generalize this to apply to all operators. Currently
> foo~3 is expanded to foo^^^. How about ~~X (or xN) denote repeat the
> last operator N times? For example, HEAD^2x3 => HEAD^2^2^2,
> HEAD^{/foo}x3 => HEAD^{/foo}^{/foo}^{/foo}.

Unless you allow grouping, it wouldn't help in the case of ^{/foo},
because ^{/foo} is idempotent.  HEAD^{/foo} finds first commit that
contains "foo", and HEAD^{/foo}^{/foo} finds first commit containing
"foo" starting from *and including* first commit from HEAD containing
"foo" - which is HEAD^{/foo}

  HEAD^{/foo}^{/foo} === HEAD^{/foo}

You would need HEAD{^{/foo}^@}x3, or use special rule that HEAD^{/foo}x2
means really HEAD^{/foo}^@^{/foo}, with ^@ used to join them.

-- 
Jakub Narebski
Poland