git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git feature request: git blame --ignore-cleanup/--ignore-trivial

From
Jeff King <peff@peff.net>
Date
Jun 2, 2021, 19:37 UTC
Message-ID
<YLfd5pWtRqde1++Y@coredump.intra.peff.net>
In-Reply-To
<30399052.5964.1622647235870.JavaMail.zimbra@efficios.com>
On Wed, Jun 02, 2021 at 11:20:35AM -0400, Mathieu Desnoyers wrote:
Show 7 quoted lines
> Considering the added value brought by splitting cleanups from functional changes
> from a maintainer perspective (easier reverts) and from a reviewer perspective
> (easier to focus on the functional changes), I think it would be good to improve
> the git tooling to allow easily filtering out the noise from git blame.
> 
> Perhaps a new git blame "--ignore-trivial" and/or "--ignore-cleanup" could solve
> this by filtering out "trivial" and "cleanup" patches from the history it considers.

There's "-w" to ignore whitespace-only changes. Since Git v2.23.0, there's also "--ignore-rev-file", which lets you ignore arbitrary commits. Since you have to generate a separate list of commits to feed it, it's a little more involved than your "--invert-grep" example. But it's also much more flexible (you can generate the file however you like, and even tweak it by hand).

I do tend to agree with Al's notion that commits which are _supposed_ to be trivial sometimes end up not being so. Or another way of thinking about it is: relevance is a property of the query you're making, not the original change.

So IMHO the best tool for this kind of thing is the "re-blame from parent" feature that many interactive blame viewers have (I use tig, but I'm sure other tools like magic have a similar feature). There when you land on a boring commit, it's a single key to skip past it and see how the earlier code came about.

-Peff
Previous: David SterbaNext: Felipe Contreras
Message 6 of 8 in “git feature request: git blame --ignore-cleanup/--ignore-trivial”
  1. Mathieu DesnoyersJun 2, 2021
  2. Al ViroJun 2, 2021
  3. Taylor BlauJun 2, 2021
  4. Mathieu DesnoyersJun 3, 2021
  5. David SterbaJun 3, 2021
  6. Jeff KingJun 2, 2021
  7. Felipe ContrerasJun 2, 2021
  8. David SterbaJun 3, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.