All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yann Dirson <dirson@bertin.fr>
To: Kevin Ballard <kevin@sb.org>
Cc: Junio C Hamano <gitster@pobox.com>,
	git list <git@vger.kernel.org>, Jeff King <peff@peff.net>
Subject: Re: [RFC] Using gitrevisions :/search style with other operators
Date: Wed, 10 Nov 2010 08:32:09 +0100	[thread overview]
Message-ID: <20101110083209.6a1252ef@chalon.bertin.fr> (raw)
In-Reply-To: <050F42EE-34FE-499F-B632-471597EB4881@sb.org>

On Tue, 09 Nov 2010 16:33:31 -0800
Kevin Ballard <kevin@sb.org> wrote:

> On Nov 9, 2010, at 4:18 PM, Junio C Hamano wrote:
> 
> > 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.

I usually always have a gitk displaying history.  Whereas it shows the
commit summary, it does not show the sha1 for each commit - and even if
it did, my brain is still more comfortable dealing with words than
hashes (though that may arguably be an effect of aging ;)

> 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 use for counting would be for reflog, to lookup things like
"2nd to last of yesterday's commits" - that could be spelled like
"master^{:2:yesterday}" or similar.  Not sure it's worth it (I hardly
use the @{anything vague} syntax myself, especially because it is so
vague), but that looked similar enough to be mentionned here.

> 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.

-- 
Yann Dirson - Bertin Technologies

  reply	other threads:[~2010-11-10  7:42 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-09  7:30 [RFC] Using gitrevisions :/search style with other operators Yann Dirson
2010-11-09  8:06 ` Kevin Ballard
2010-11-09  9:24   ` Yann Dirson
2010-11-10  0:18     ` Junio C Hamano
2010-11-10  0:33       ` Kevin Ballard
2010-11-10  7:32         ` Yann Dirson [this message]
2010-11-10  7:46           ` Kevin Ballard
2010-11-10  7:46             ` Yann Dirson
2010-11-10 15:26               ` Jakub Narebski
2010-11-10 16:37                 ` [PATCH] get_sha1: support relative path "<obj>:<sth>" syntax Nguyễn Thái Ngọc Duy
2010-11-10 17:17                   ` Matthieu Moy
2010-11-10 17:47                   ` Jonathan Nieder
2010-11-11 13:18                     ` Nguyen Thai Ngoc Duy
2010-11-10 19:34                   ` Junio C Hamano
2010-11-11  1:30                     ` Nguyen Thai Ngoc Duy
2010-12-09 21:10                   ` Junio C Hamano
2010-12-09 21:37                     ` Junio C Hamano
2010-12-10  1:35                       ` Nguyen Thai Ngoc Duy
2010-11-10 17:23                 ` [RFC] Using gitrevisions :/search style with other operators Junio C Hamano
2010-11-10 18:19                   ` Jakub Narebski
2010-11-09 16:10 ` Jeff King
  -- strict thread matches above, loose matches on Subject: below --
2010-11-05 22:38 Kevin Ballard
2010-11-08 19:09 ` Junio C Hamano
2010-11-08 22:11   ` Kevin Ballard
2010-11-09  5:16     ` Jeff King
2010-11-09 15:59       ` Junio C Hamano
2010-11-09 16:08         ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101110083209.6a1252ef@chalon.bertin.fr \
    --to=dirson@bertin.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=kevin@sb.org \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.