Re: [RFC] Using gitrevisions :/search style with other operators
- From
Kevin Ballard <kevin@sb.org>
- Date
- Nov 10, 2010, 00:33 UTC
- Message-ID
- <050F42EE-34FE-499F-B632-471597EB4881@sb.org>
- In-Reply-To
- <7vlj52jakh.fsf@alter.siamese.dyndns.org>
On Nov 9, 2010, at 4:18 PM, Junio C Hamano wrote:
Show 13 quoted lines
> Yann Dirson <dirson@bertin.fr> writes:
>
>>>> Syntax like origin/pu^{/Merge 'kb/blame-author-email'}2 would be
>> ...
>> Another idea: origin/pu^{:2/Merge 'kb/blame-author-email'}
>
> What are these "2"s?
>
> You need to question how you figured out the commit you want is the second
> one reachable (in whatever traversal order) from something in the first
> place. Didn't you use "git log --oneline" or something to find that out?
> At that point, you have the object name already, so I doubt such a
> "counting" feature is of much practical use.The particular case that prompted this for me was I knew I had created two commits called "WIP", scheduled for renaming later, and I wanted to quickly look at the contents of the first one. I would have loved to be able to type something like `git show :/WIP/2`. I suppose this situation may be rare enough not to bother supporting it in the new syntax. With the new syntax it will be possible to do something like `git show HEAD^{:/WIP}^^{:/WIP}`, but that looks awfully awkward.
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.
-Kevin Ballard