From 50a0e45309b3834e52c6e2c5192b84f0ebca2631 Mon Sep 17 00:00:00 2001 From: Alexander Hess Date: Sat, 28 Nov 2026 03:09:39 +0100 Subject: [PATCH] Ignore the double quotes commit in `git blame` --- .git-blame-ignore-revs | 5 +++++ noxfile.py | 13 +++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 .git-blame-ignore-revs diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000..c957f76 --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,5 @@ +# Mechanical commits that `git blame` skips +# => Enable locally with `git config blame.ignoreRevsFile .git-blame-ignore-revs` + +# Use double quotes +ea8f1a13e34bfce01ea66951311e5f5fb5ab967f diff --git a/noxfile.py b/noxfile.py index 8c55b02..84a941f 100644 --- a/noxfile.py +++ b/noxfile.py @@ -15,7 +15,7 @@ Further sessions run on demand with `uv run nox -s `: - "deps-lock": Lock dependencies after manual changes in pyproject.toml - "deps-upgrade": Upgrade dependencies within their allowed ranges - "deps-upgrade-check": Show newer versions and the age of all pinned releases -- "init-project": Install the `pre-commit` hooks +- "init-project": Install the `pre-commit` hooks and configure `git blame` - "clean-cwd": Run approx. `git clean -X` with minor exceptions Most sessions accept extra arguments after the "--", @@ -450,10 +450,19 @@ def check_dependency_upgrades(session: Session) -> None: @nox.session(name="init-project", python=MAIN_PYTHON, venv_backend="none") def initialize_project(session: Session) -> None: - """Install the `pre-commit` hooks.""" + """Install the `pre-commit` hooks and configure `git blame`.""" # .pre-commit-config.yaml sets the hook types via "default_install_hook_types" session.run("uv", "run", "pre-commit", "install") + # Skip the commits listed in .git-blame-ignore-revs in `git blame` + session.run( + "git", + "config", + "blame.ignoreRevsFile", + ".git-blame-ignore-revs", + external=True, + ) + @nox.session(name="clean-cwd", python=MAIN_PYTHON, venv_backend="none") def clean_cwd(session: Session) -> None: