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

Re: [PATCH v2 1/2] blame: respect .git-blame-ignore-revs automatically

From
Taylor Blau <me@ttaylorr.com>
Date
Oct 14, 2024, 21:08 UTC
Message-ID
<Zw2IYMPsywFCN5Yj@nand.local>
In-Reply-To
<CAPig+cR4WbcDDav0cdXxOMC-EDe2ipWxEzB+0C7zbFjvY_kXtg@mail.gmail.com>
On Sat, Oct 12, 2024 at 02:07:36AM -0400, Eric Sunshine wrote:
Show 31 quoted lines
> > diff --git a/builtin/blame.c b/builtin/blame.c
> > @@ -1105,6 +1105,14 @@ parse_done:
> > +       /*
> > +       * By default, add .git-blame-ignore-revs to the list of files
> > +       * containing revisions to ignore if it exists.
> > +       */
> > +       if (access(".git-blame-ignore-revs", F_OK) == 0) {
> > +               string_list_append(&ignore_revs_file_list, ".git-blame-ignore-revs");
> > +       }
>
> A couple style nits and a couple questions...
>
> nit: drop the braces around the one-line `if` body
>
> nit: this project uses `!foo(...)` rather than `foo(...) == 0`
>
> Presumably this consults ".git-blame-ignore-revs" in the top-level
> directory (as you intended) rather than ".git-blame-ignore-revs" in
> whatever subdirectory you happen to issue the command because the
> current-working-directory has already been set to the top-level
> directory by the time cmd_blame() has been called, right?
>
> But that leads to the next question. Should automatic consulting of
> ".git-blame-ignore-revs" be restricted to just the top-level
> directory, or should it be modeled after, say, ".gitignore" which may
> be strewn around project directories and in which ".gitignore" files
> are consulted rootward starting from the directory in which the
> command is invoked. My knee-jerk thought was that the ".gitignore"
> model may not make sense for ".git-blame-ignore-revs", but the fact
> that `git blame` can accept and work with multiple ignore-revs files
> makes me question that knee-jerk response.
All very good suggestions and questions for Abhijeetsingh to consider.

At a minimum, I think the style nits need to be addressed here. But I also think it is worth considering seriously whether or not multiple `.git-blame-ignore-revs` files should be considered, and if so, in what order and how they override (or not) each other.

I am generally OK with adding one of these special files and having 'git blame' respect it automatically. But once we do so, it is going to be considered part of our compatibility guarantee, so we should get it right the first time.

Thanks, Taylor

Previous: Eric SunshineNext: Abhijeetsingh Meena
Message 8 of 24 in “blame: respect .git-blame-ignore-revs automatically”
  1. blame: respect .git-blame-ignore-revs automaticallyAbhijeetsingh Meena via GitGitGadget, Oct 8, 2024
  2. Kristoffer HaugsbakkOct 8, 2024
  3. Phillip WoodOct 8, 2024
  4. 0/2 blame: respect .git-blame-ignore-revs automaticallyAbhijeetsingh Meena via GitGitGadget, Oct 12, 2024
  5. 1/2 blame: respect .git-blame-ignore-revs automaticallyAbhijeetsingh Meena via GitGitGadget, Oct 12, 2024
  6. Eric SunshineOct 12, 2024
  7. Eric SunshineOct 12, 2024
  8. Taylor BlauOct 14, 2024
  9. Abhijeetsingh MeenaOct 16, 2024
  10. Kristoffer HaugsbakkOct 12, 2024
  11. Phillip WoodOct 13, 2024
  12. Kristoffer HaugsbakkOct 14, 2024
  13. Abhijeetsingh MeenaOct 16, 2024
  14. Phillip WoodOct 13, 2024
  15. Abhijeetsingh MeenaOct 16, 2024
  16. Abhijeetsingh MeenaOct 22, 2024
  17. Eric SunshineOct 22, 2024
  18. 2/2 blame: introduce --override-ignore-revs to bypass ignore revisions listAbhijeetsingh Meena via GitGitGadget, Oct 12, 2024
  19. Eric SunshineOct 12, 2024
  20. Eric SunshineOct 12, 2024
  21. Kristoffer HaugsbakkOct 12, 2024
  22. Phillip WoodOct 13, 2024
  23. Abhijeetsingh MeenaOct 8, 2024
  24. Abhijeetsingh MeenaOct 8, 2024

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.