git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Michael J Gruber <git@drmicha.warpmail.net>
Cc: Vincent van Ravesteijn <vfr@lyx.org>,
	Git Mailing List <git@vger.kernel.org>,
	bebarino@gmail.com, johan@herland.net
Subject: Re: Git notes list/show <revision-range>
Date: Tue, 19 Apr 2011 16:32:11 -0400	[thread overview]
Message-ID: <20110419203211.GA12071@sigill.intra.peff.net> (raw)
In-Reply-To: <4DAD371F.9040003@drmicha.warpmail.net>

On Tue, Apr 19, 2011 at 09:17:51AM +0200, Michael J Gruber wrote:

> But since the OP is volunteering to code for notes :-)
> We could need a feature which allows to log the history of a note. The alias
> 
> `git noteslog' is aliased to `!sh -c 'git log $(git notes get-ref) "$@"' -'
> 
> gives you the history of the notes tree (try it with "-p"),

Hmm, I just use "git log notes/<whatever>", which works fine. It does
help if you know that the default ref is "notes/commits", though.

It's not something I do often, though (most of my notes use has been
things that automatically make notes, so the history tends to be
uninteresting and useful only for debugging the note-making code).

> sometimes I would like the history of the notes to a specific commit, and in
> 
> git noteslog -p -- $(commit)
> 
> I would have to use for $(commit) all possible breakdowns of the sha1 of
> the commit for all possible notes tree structures. It feels as of the
> revision walker needs to learn another pathspec, say
> 
> ":(note):<sha1>"
> 
> in line with our magic pathspec discussion.

That's a clever solution. It is a little non-intuitive for a user to
need to know about notes storage, though. Maybe you were already
thinking this, but we could have something like:

  git notes log [revs] [--] [pathspec]

where "[revs]" are checked for in refs/notes/*, defaulting to
"refs/notes/commits". And each element of the pathspec gets the
":(note):" magic automatically. I wonder if we could even resolve the
pathspec bits as regular refs.

So you could write:

  # long form, just as you can do with "git log"
  git notes log notes/commits -- ":(note):`git rev-parse HEAD`"

  # or with automagic ref lookup for pathspec
  git notes log notes/commits -- HEAD

  # and automagic default ref
  git notes log -- HEAD

  # and I think you should be able to write a disambiguator similar to
  # what we use for the revs/paths distinction, but this time for
  # notes-refs versus regular refs. And then drop the "--":
  git notes log HEAD

I think it would need a little refactoring of setup_revisions() to be
more flexible, but most of the hard work is already done by the usual
revision traversal mechanism.

-Peff

  reply	other threads:[~2011-04-19 20:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-18 18:19 Git notes list/show <revision-range> Vincent van Ravesteijn
2011-04-18 18:27 ` Jeff King
2011-04-19  7:17   ` Michael J Gruber
2011-04-19 20:32     ` Jeff King [this message]
2011-04-20  7:16       ` Michael J Gruber
2011-04-20  7:35         ` 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=20110419203211.GA12071@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=bebarino@gmail.com \
    --cc=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=johan@herland.net \
    --cc=vfr@lyx.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).