Hi,
On Thu, Mar 14, 2013 at 12:27:06AM +0100, Krinkle wrote:
Can git notes be changed after merge?
Yes.
Do they show in Gerrit diffs, so we don't accidentally lose them if someone else pushed an amend without the tags?
No. At least not yet :-)
Can they be removed after merge?
Yes. And they are under revision control themselves. So you can have a look at when a note was added by whom etc.
Can one query for commits having a certain tag within a repo/branch/author? (eg. "fixme" commits by me in mw core)
As there is no native support in gerrit yet to query such objects, querying relies mostly on command line tools. Notes are plain text files stored along the main repository.
As we currently have no fixme tags set in core, but only links to CodeReview, let me rephrase your demo query "fixme" commits by me in mw core to commits by me in mw core linking to CodeReview with a seven in its number .
Given you have fetched core's existing commit notes [1], you could query for that like git log --show-notes --author='Christian Aistleitner' --grep 'Special:Code.*7' . And you'll get [2] as result. Those are my commits to core when it was still on CodeReview and CodeReview number contains a 7.
So how could queries for tags look like when using git notes? Your original query might look like
git log --show-notes --author='Christian Aistleitner' --grep '^ Tag: fixme$'
. Since notes is free-form text, we would probably want to add some '[[:space:]]*', ignore case, etc. But it's up to us to decide upon the rules and decide, how a "correct" tag has to be represented. And we have aliasing in git to save us from typing the same things over and over again.
One caveat (for now) is that we would also catch commits, where the commit message itself (instead of a git note) contains the tag. But that might actually turn out to be a benefit instead of a caveat.
If we want to avoid matching also on the commit message and limit to notes only, we can always checkout refs/notes/commits to have the plain git notes in the file system and do our querying directly on the notes files.
If not on displayed in Gerrit, then from git-cli via a web tool (how does that grep perform, is it fast enough?)
time git log --notes --author='Christian Aistleitner' --grep 'Special:Code.*7' >/dev/null
real 0m0.683s user 0m0.670s sys 0m0.011s
So that's <1s for a plain spinning disk (no SSD) with cold caches grepping the whole history of core. That'd be good enough for me :-)
Although the above timings do not reflect a good real-world sample, as our current git notes in core stem from a single commit. Nevertheless, git has to go through the whole core history, as grep does not limit to notes. So, querying through git history is typically fast. Even for core. And querying through notes is basically doing the same thing.
Best regards, Christian
[1] You can do so by issueing git fetch origin refs/notes/commits:refs/notes/commits . Just like "git clone" it's slow for the first fetch. Follow-up fetches are much, much quicker.
[2] -----8<-----Begin-----8<----- commit b23761744f237c5d9b4b1cabee4f5e76fc819213 Author: Christian Aistleitner qchris@users.mediawiki.org Date: Tue Mar 20 12:00:18 2012 +0000
Follow-up to r114256: Removing final assert
Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/114257
commit 42c88dc137752e49143627416c585436721f0226 Author: Christian Aistleitner qchris@users.mediawiki.org Date: Mon Mar 19 23:36:48 2012 +0000
Follow up to r114126: Being more conservative for HipHop compiler
Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/114217 -----8<-----End-----8<-----