Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ repos:

# Commitizen enforces semantic and conventional commit messages.
- repo: https://github.com/commitizen-tools/commitizen
rev: 2ca29f9297911f8f5a4e8f97100b7832f045e8d3 # frozen: v4.13.10
rev: 953e1ba4599cc3143122ed5c3e8de3d6dfd5524d # frozen: v4.16.2
hooks:
- id: commitizen
name: Check conventional commit message
stages: [commit-msg]

# Sort imports.
- repo: https://github.com/pycqa/isort
rev: dac090ce4d9ee313d086e2e89ab1acb8c2664fa1 # frozen: 9.0.0a3
rev: a333737ed43df02b18e6c95477ea1b285b3de15a # frozen: 8.0.1a3
hooks:
- id: isort
name: Sort import statements
Expand All @@ -32,18 +32,18 @@ repos:

# Add Black code formatters.
- repo: https://github.com/ambv/black
rev: c6755bb741b6481d6b3d3bb563c83fa060db96c9 # frozen: 26.3.1
rev: 87928e6d6761a4a6d22250e1fee5601b3998086e # frozen: 26.5.1
hooks:
- id: black
name: Format code
args: [--config, pyproject.toml]
- repo: https://github.com/asottile/blacken-docs
rev: dda8db18cfc68df532abf33b185ecd12d5b7b326 # frozen: 1.20.0
rev: fda77690955e9b63c6687d8806bafd56a526e45f # frozen: 1.20.0
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Investigate why this change has the same version tag with different hashes. The same happens below for flake8 and actionlint.

Copy link
Copy Markdown
Owner

@jenstroeger jenstroeger May 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We introduced the original sha dda8db18cfc68df532abf33b185ecd12d5b7b326 with PR #1156, and I’m almost certainly sure that at that time the sha was the valid commit sha for tag 1.20.0. However, now that original commit sha adamchainz/blacken-docs@dda8db1 does not exist; instead, tag 1.20.0 points at commit adamchainz/blacken-docs@fda7769. 1 And so, Dependabot now updates the rev to the latest and correct sha while keeping the tag the same.

If I had to make a guess then I’d say that the repo’s history was force-pushed at some point and the tag 1.20.0 was reassigned to a different commit, though I can’t see that in the activities here. @adamchainz might be able to shed some light on this?

Remains the question why pre-commit accepts an invalid rev dda8db1 without a warning and then seems to clone the latest tag:

~/.cache/pre-commit/repo6dn9_crd > git log
commit fda77690955e9b63c6687d8806bafd56a526e45f (grafted, HEAD)
Author: Adam Johnson <me@adamj.eu>
Date:   Mon Sep 8 16:31:35 2025 +0100

    Version 1.20.0

I didn’t find this behavior documented here, and I didn’t find an issue discussing handling of an invalid/nonexistent rev here. However, following the pre-commit code in Store.clone() here I can reproduce the behavior with plain git:

/tmp/bla > git init 
Initialized empty Git repository in /private/tmp/bla/.git/
/tmp/bla > git remote add origin https://github.com/adamchainz/blacken-docs
/tmp/bla > git -c protocol.version=2 fetch origin dda8db18cfc68df532abf33b185ecd12d5b7b326 --depth=1
remote: Enumerating objects: 33, done.
remote: Counting objects: 100% (33/33), done.
remote: Compressing objects: 100% (29/29), done.
remote: Total 33 (delta 0), reused 22 (delta 0), pack-reused 0 (from 0)
Unpacking objects: 100% (33/33), 36.34 KiB | 418.00 KiB/s, done.
From https://github.com/adamchainz/blacken-docs
 * branch            dda8db18cfc68df532abf33b185ecd12d5b7b326 -> FETCH_HEAD
/tmp/bla > git checkout FETCH_HEAD
Note: switching to 'FETCH_HEAD'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -c with the switch command. Example:

  git switch -c <new-branch-name>

Or undo this operation with:

  git switch -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at fda7769 Version 1.20.0
/tmp/bla > git log
commit fda77690955e9b63c6687d8806bafd56a526e45f (grafted, HEAD)
Author: Adam Johnson <me@adamj.eu>
Date:   Mon Sep 8 16:31:35 2025 +0100

    Version 1.20.0

/tmp/bla > cat .git/HEAD 
fda77690955e9b63c6687d8806bafd56a526e45f
/tmp/bla > cat .git/FETCH_HEAD 
dda8db18cfc68df532abf33b185ecd12d5b7b326		'dda8db18cfc68df532abf33b185ecd12d5b7b326' of https://github.com/adamchainz/blacken-docs

If I use a random other commit sha:

/tmp/bla > git -c protocol.version=2 fetch origin c84ac2a20d4da9de5e920603a4d41648ce2cf283 --depth=1
fatal: remote error: upload-pack: not our ref c84ac2a20d4da9de5e920603a4d41648ce2cf283

So git “knows” something here, and I’m still unclear how git manages to connect these two commit shas 🤔

Footnotes

  1. Note also that the repo has moved, as per comment here.

hooks:
- id: blacken-docs
name: Format code in docstrings
args: [--line-length, '120']
additional_dependencies: [black==26.3.1]
additional_dependencies: [black==26.5.1]

# Upgrade and rewrite Python idioms.
- repo: https://github.com/asottile/pyupgrade
Expand All @@ -57,13 +57,13 @@ repos:
# Similar to pylint, with a few more/different checks. For more available
# extensions: https://github.com/DmytroLitvinov/awesome-flake8-extensions
- repo: https://github.com/pycqa/flake8
rev: d93590f5be797aabb60e3b09f2f52dddb02f349f # frozen: 7.3.0
rev: c48217e1fc006c2dddd14df54e83b67da15de5cd # frozen: 7.3.0
hooks:
- id: flake8
name: Check flake8 issues
files: ^src/package/|^tests/
types: [text, python]
additional_dependencies: [flake8-bugbear==25.11.29, flake8-builtins==3.1.0, flake8-comprehensions==3.17.0, flake8-docstrings==1.7.0, flake8-logging==1.8.0, flake8-mutable==1.2.0, flake8-noqa==1.4.0, flake8-print==5.0.0, flake8-pyi==25.5.0, flake8-pytest-style==2.2.0, flake8-rst-docstrings==0.4.0, pep8-naming==0.15.1]
additional_dependencies: [flake8-bugbear==25.11.29, flake8-builtins==3.1.0, flake8-comprehensions==3.17.0, flake8-docstrings==1.7.0, flake8-logging==1.8.0, flake8-mutable==1.2.0, flake8-noqa==1.5.0, flake8-print==5.0.0, flake8-pyi==26.5.0, flake8-pytest-style==2.2.0, flake8-rst-docstrings==0.4.0, pep8-naming==0.15.1]
args: [--config, .flake8]

# Run Pylint from the local repo to make sure venv packages
Expand Down Expand Up @@ -156,7 +156,7 @@ repos:

# Check GitHub Actions workflow files.
- repo: https://github.com/Mateusz-Grzelinski/actionlint-py
rev: c04ed26e40637cab1aa9879c693832a9c120fb20 # frozen: v1.7.12.24
rev: 2f3dbd354aa118b539dee99d8eed05a83097a199 # frozen: v1.7.12.24
hooks:
- id: actionlint

Expand Down
Loading