Skip to content

Ability to ignore revs in git blame #181

@JohnnyMorganz

Description

@JohnnyMorganz

Description

Native git supports --ignore-rev / --ignore-revs-file for the git blame command to allow ignoring commits when computing git blame for each line, "as if the change never happened".

It does not currently seem possible to do this in jgit. It would be nice to have an equivalent.

Motivation

In the age of automated tooling such as code formatters, it is common to apply a mass refactoring in a repository (e.g., introducing a new formatting and aligning existing code to the new formatting). These mass refactoring commits do not change business logic, and so typically we want to ignore them from the git blame view to prevent noise. This is possible in git with the --ignore-revs command (and the common .git-blame-ignore-revs file).

We are interested in support for .git-blame-ignore-revs in Gerrit (https://issues.gerritcodereview.com/issues/40015236), however there is no support for ignore revs in JGit's blame generation feature, which Gerrit / Gitiles uses (https://gerrit.googlesource.com/gitiles/+/refs/heads/master/java/com/google/gitiles/blame/cache/BlameCacheImpl.java)

Some background: https://github.com/orgs/community/discussions/5033 / https://docs.github.com/en/repositories/working-with-files/using-files/viewing-and-understanding-files#ignore-commits-in-the-blame-view

Alternatives considered

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions