* characterizing commits
@ 2008-12-13 8:28 William Pursell
2008-12-13 8:52 ` Jeff King
0 siblings, 1 reply; 2+ messages in thread
From: William Pursell @ 2008-12-13 8:28 UTC (permalink / raw)
To: git
I have a desire to add metadata to commits to characterize
their importance/type. (Or I'd like another recommended
method to achieve the following behavior).
A lot of commits in any given project can be grouped into
different types. eg, looking at the history for git,
there are a lot of merge commits, a lot of commits
that only touch gitk, a lot of 'auto-generated manpages',
a lot of 'typo in documentation' etc. In my own
projects, I have a fairly high percentage of commits
that are trivial (eg whitespace only, typos, etc).
What I'm after is the ability to do something like:
git log --group=!trivial
git log --group=importance:3+
and only get the log for those commits that have been
not been classified "trivial" or that have a precedence
of 3 or greater.
For example, I'd like the following work flow:
$ git log --pretty=oneline
e62bb07a6894d282cdc0fdba6c67ae2ecd086cbb 5
b0986c6e8415c45e123e1838fbe8bf9e8518a90d 4
89916e36bae3208a76c338e91508759787563042 3
3942ef4e118dde3d844da5d84f466ac9666fae62 2
6fa2e40ed491d1dcbbfac9f2d301b517413bec3b 1
04dcd38a8cb6496e37594a273ca39542912ca1eb important
9bd23c2d08e254058a1a9709f963737dc9a71d16 trivial change
$ git group 6fa2e trivial
$ git group 9bd23 trivial
$ git log --pretty=oneline --group=!trivial
e62bb07a6894d282cdc0fdba6c67ae2ecd086cbb 5
b0986c6e8415c45e123e1838fbe8bf9e8518a90d 4
89916e36bae3208a76c338e91508759787563042 3
3942ef4e118dde3d844da5d84f466ac9666fae62 2
04dcd38a8cb6496e37594a273ca39542912ca1eb important
Is there already a mechanism for filtering
commits that I could extend to accomplish this?
--
William Pursell
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: characterizing commits
2008-12-13 8:28 characterizing commits William Pursell
@ 2008-12-13 8:52 ` Jeff King
0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2008-12-13 8:52 UTC (permalink / raw)
To: William Pursell; +Cc: git
On Sat, Dec 13, 2008 at 08:28:12AM +0000, William Pursell wrote:
> A lot of commits in any given project can be grouped into
> different types. eg, looking at the history for git,
> there are a lot of merge commits, a lot of commits
> that only touch gitk, a lot of 'auto-generated manpages',
> a lot of 'typo in documentation' etc. In my own
> projects, I have a fairly high percentage of commits
> that are trivial (eg whitespace only, typos, etc).
> What I'm after is the ability to do something like:
>
> git log --group=!trivial
> git log --group=importance:3+
>
> [...]
> Is there already a mechanism for filtering
> commits that I could extend to accomplish this?
Generally you would put a pseudo-header into your commit message, like:
Status: trivial
Importance: 3
and then use --grep to filter matching commits:
git log --grep="Status: trivial"
git log --grep="Importance: [3-9]"
Obviously the syntax is a little bit clunkier. You could fix that with
an option to parse arbitrary pseudo-headers (and even support numeric
relations), something like:
git log --filter='importance > 3'
which would be converted internally to a grep of the commit message like
this:
/^importance: (\d+)/i
and compare the result to 3.
The nice thing about that approach is that the storage remains the same:
text in the commit message. That means it gets displayed when you look
at the commit, people with older versions of git can still read it, etc.
One thing this _doesn't_ get you is annotating commits after the fact.
This has been discussed in the past; try searching the list for "notes".
-Peff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-12-13 8:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-13 8:28 characterizing commits William Pursell
2008-12-13 8:52 ` Jeff King
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).