git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: William Pursell <bill.pursell@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: characterizing commits
Date: Sat, 13 Dec 2008 03:52:28 -0500	[thread overview]
Message-ID: <20081213085228.GA20282@coredump.intra.peff.net> (raw)
In-Reply-To: <4943721C.7070200@gmail.com>

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

      reply	other threads:[~2008-12-13  8:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-13  8:28 characterizing commits William Pursell
2008-12-13  8:52 ` Jeff King [this message]

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=20081213085228.GA20282@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=bill.pursell@gmail.com \
    --cc=git@vger.kernel.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).