Re: characterizing commits

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux