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

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

From
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Date
Jun 3, 2021, 15:33 UTC
Message-ID
<654904857.6915.1622734437354.JavaMail.zimbra@efficios.com>
In-Reply-To
<YLfe+HXl4hkzs44b@nand.local>
----- On Jun 2, 2021, at 3:41 PM, Taylor Blau me@ttaylorr.com wrote:
Show 20 quoted lines
> On Wed, Jun 02, 2021 at 03:29:44PM +0000, Al Viro wrote:
>> > Any maybe the patterns associated to "cleanup" and "trivial" commits
>> > should be something that can be configured through a git config
>> > file.
>>
>> Just an observation: quite a few subtle bugs arise from mistakes in
>> what should've been a trivial cleanup.  Hell, I've seen bugs coming
>> from rebase of provably no-op patches - with commit message unchanged.
>> So IME this is counterproductive...
> 
> Yes, I find excluding revisions from 'git blame' to be rarely useful,
> exactly for this reason.
> 
> You could probably use the '--ignore-revs-file' option of 'git blame' to
> exclude commits you consider trivial ahead of time. If you had an
> 'Is-trivial' trailer, I would probably do something like:
> 
>  $ git log --format='%H %(trailers:key=Is-trivial)' |
>      grep "Is-trivial: true" | cut -d" " -f1 >exclude
>  $ git blame --ignore-revs-file exclude ...

Nice trick! So within a project which standardize on a "Cleanup: " prefix at the beginning of the patch subject, this would look like:

git log --format='%H Subject=("%s")' file.c | grep 'Subject=(\"Cleanup: ' | cut -d" " -f1 > exclude.txt git blame --ignore-revs-file exclude.txt file.c

I fully understand that in many cases having the entire set of revisions is needed, because even a cleanup patch could be buggy, but IMHO it's nice to have a way to achieve this in situations where the cleanup patches get in the way of figuring out the most recent behavior changes in a given area of the code.

Thanks,
Mathieu
-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
Previous: Taylor BlauNext: David Sterba
Message 4 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.