By the way, we should seriously rethink how notes should propagate through rebases and amends. I've been using this in my post-applypatch hook lately:
-- >8 -- cut here -- >8 -- #!/bin/sh GIT_DIR=.git dotest="$GIT_DIR/rebase-apply"
prec=4 &&
this=$(cat 2>/dev/null "$dotest/next") &&
msgnum=$(printf "%0${prec}d" $this) &&
test -f "$dotest/$msgnum" &&
message_id=$(sed -n '
/^Message-I[Dd]:[ ]*\(<.*>\)[ ]*$/{
s//\1/p
q
}
/^$/q
' "$dotest/$msgnum") &&
test -n "$message_id" &&
GIT_NOTES_REF=refs/notes/amlog \
git notes edit -m "Message-Id: $message_id" HEAD
-- 8< -- upto here -- 8< --together with this in $HOME/.gitconfig
-- >8 -- cut here -- >8 --
[alias]
lgm = "!sh -c 'GIT_NOTES_REF=refs/notes/amlog git log \"$@\" || :' -"
-- 8< -- upto here -- 8< --
so that I can say:
$ git lgm -1 jh/maint-config-file-prefix
commit 65807ee697a28cb30b8ad38ebb8b84cebd3f255d
Author: Johan Herland <johan@herland.net>
Date: Tue Jan 26 16:02:16 2010 +0100 builtin-config: Fix crash when using "-f <relative path>" from non-root dir
When your current directory is not ...
...
Notes:
Message-Id: <201001261602.16876.johan@herland.net>A few observations I made myself so far:
- I used to fix minor issues (styles, decl-after-stmt, etc.) using
rebase-i long after running "am" in bulk, but these days I find myself
going back to my "inbox" and fix them in MUA; this is only because I
know these notes do not propagate across rebases and amends---adjusting
the workflow to the tool's limitation is not very good.
- The interface to tell tools to use which notes ref to use should be
able to say "these refs", not just "this ref" i.e. GIT_NOTES_REF=a:b
just like PATH=a:b:c...); I am fairly certain that we would want to
store different kind of information in separate notes trees and
aggregate them, as we gain experience with notes.
- There should be an interface to tell tools to use which notes refs via
command line options; "!alias" does not TAB-complete, and "git lgm"
above doesn't, either. "git log --notes=notes/amlog --notes=notes/other"
would probably be the way to go.
- While reviewing the "inbox", I sometimes wonder if I applied a message
to somewhere already, but there is no obvious way to grep in the notes
tree and get the object name that a note is attached to. Of course I
know I can "git grep -c johan@herland.net notes/amlog" and it will give
me something like:
notes/amlog:65807ee697a28cb30b8ad38ebb8b84cebd3f255d:1
notes/amlog:c789176020d6a008821e01af8b65f28abc138d4b:1 but this won't scale and needs scripting to mechanize, once we start
rebalancing the notes tree with different fan-outs. The end user (me
in this case) is interested in "set of objects that match this grep
criteria", not "the pathnames the notes tree's implementation happens
to use to store notes for them in the hierarchy".