Re: [RFC] Using gitrevisions :/search style with other operators
- From
Jeff King <peff@peff.net>
- Date
- Nov 9, 2010, 05:16 UTC
- Message-ID
- <20101109051631.GA19867@sigill.intra.peff.net>
- In-Reply-To
- <4F75AA0C-B68A-4ABB-B67A-D7F62D989655@sb.org>
On Mon, Nov 08, 2010 at 02:11:54PM -0800, Kevin Ballard wrote:
Show 13 quoted lines
> > $ git log 'HEAD..:( :/Merge branch 'kb/blame-author-email' )^2' > > > > I haven't visited the particular codepath for some time, so I don't know > > offhand how involved the change would be, though. > > Interesting idea. It certainly solves the problem of being able to embed it > within other operations (though you do then have to worry about escaping any > embedded close-parens in the search), though it does mean my suggestion for > being able to select the 2nd (or nth) match won't work. When I have the time > I'll start taking a look at the code. > > Any comments on my suggestion to specify the ref to search from, e.g. > origin/pu:/"Merge 'kb/blame-author-email'"? As I stated before, I believe
It seems to me the natural way to do that would be to use our existing generic "start at this ref and follow some chain" syntax, which is ref^{foo}. For example: origin/pu^{:Merge 'kb/blame-author-email'}.
We already use it for "follow tree link" and "peel tag objects", and it is syntactically similar to the usual "follow the ancestry chain" syntax ("ref^"). And I believe it should be unambiguous, as nothing that could go in ^{} could start with ":". And presumably one would have to backslash-escape embedded closing curly braces.
We also have ref@{upstream}. The analogue here would be origin/pu@{:Merge 'kb/blame-author-email'}.
I don't recall whether we put any conscious thought into ref@{upstream} versus ref^{upstream}. Certainly the former implies to me finding a particular starting point (as we do for reflogs), and the latter implies walking object graph (either by parent ancestry links, or through dereferencing tag and commit pointers). But I may just be rationalizing after the fact. :)
Certainly this particular case seems to me to be more like "^" or "~"; you are walking the ancestry tree not a specific number of steps, but until you see a particular subject.
-Peff