Skip to content

Set up .git-blame-ignore-revs #1253

@jrfnl

Description

@jrfnl

Outline

Follow up on #155 which made a lot of changes to the code style of this code base.

I believe it may be helpful to add a .git-blame-ignore-revs (or something along those lines) to allow for contributors to use git blame without the blame showing code style only changes.

If I remember correctly, there isn't an officially accepted standard for this and even if a .git-blame-ignore-revs file is available, it would still need to be manually set up to be used by contributors.

This needs further investigation and if it would turn out for this to be useful, the file can be added, along with some instructions in the CONTRIBUTING file for contributors to understand how to get git to recognize the file.

This also needs a good think on how to keep the .git-blame-ignore-revs file up to date, as if it isn't updated with new CS commits, it quickly loses its value.
The problem with this is, of course, that the .git-blame-ignore-revs file cannot be updated in the same commit as the CS changes which are being made as it needs the commit reference from that commit.

Any sort of automation which would help to keep the file up to date would be considered helpful. One thought which comes to mind would be a workflow which checks PR descriptions for a special marker, maybe something like '[cs-change-only]', and if it finds that marker in the PR description, the workflow would add the commit references of commits in that PR to the .git-blame-ignore-revs file and push a new commit to the PR.
The risk with a workflow like that would be "circulair dependency", i.e. the workflow would push a new commit, a new commit to the PR would trigger the workflow. So maybe the workflow should only run on merge ? And then push straight to the branch in which the PR was merged ? Though that would bypass branch protection, so is also risky.

All in all, this needs a good think.

Starting point

I did look into this a while back, but didn't finish my research. So here are some links from when I looked into this before, which can serve as a starting point:

When looking into this before, I also made a minimal start for the file, though this is far from complete and needs careful review.

  • Anything which could be considered a functional change, in contrast to just and only a code-style change, should not be included in the .git-blame-ignore-revs file.
  • Anything which only contains a change to the ruleset does not need to be included.
# To ignore coding standards changes, run git blame with this file, like so:
# git blame --ignore-revs-file .git-blame-ignore-revs

# Note: only commits which ONLY contain coding standards should be added to this list
# Mixed commits or commits where the coding standards change _also_ is a functional change
# should not be added to this list.

# This list, as-is, is incomplete. Expansion welcome.

# Coding standards commits
3756f11efafcc49ac770a40b7b3228897a6982ac # PR 347 - CS: alphabetically order import use statements
479b4dc593bf07028df528e3d173130f68578929 # PR 339 - CS: various minor fixes
724e36f876022e3990696197c5ba9c4c457d457e # PR 1232 - CS: various small whitespace fixes
8368a1f221fc8b1ebe13db4980dbccf7929622c5 # PR 1238 - CS: don't use double quotes where not needed
d1364b52cdcb753533c416609407b396832d863c # PR 1238 - CS: no unnecessary heredocs
fe53a330d4917beb444df478df66bd3f6f4e5fd2 # PR 1238 - CS: enforce consistent formatting of return types
42bc6c54d3172ca905be1bb0822f94b5ef00109f # PR 1239 - CS: always have spaces around equal sign in function declaration
6d70d3b177b57353b7fd9e4eae2ba4b59023d67c # PR 1241 - CS: single space before/after concat operators
5d99e27f150f093e09f66a1cdc358c50515da7dc # PR 1242 - CS: use elseif instead of else if
771d9dac7ebf3a13b8786867bd457de2566922a6 # PR 1243 - CS: remove class/function end comments
675cf2414aca2fe0b93b4574a646eb50cc06126c # PR 1243 - CS: remove blank line at end of functions
484b89b3f0ec27d40811c3342bfbb8425b15d5be # PR 1243 - CS: remove blank lines at end of classes
17a9d6052e0f26b834f1f7b20c7444ec5cd29438 # PR 1244 - CS: remove long condition end comments
ccdabfebd6feaf72af557765615fb55ed95aa46f # PR 1245 - CS: normalize indentation of switch statements
87bdb1526eae60e79b8acfc84a361c6833d43a22 # PR 1249 - CS: some clean up of test fixtures

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions