Skip to content

Commit fe8bc74

Browse files
committed
docs: guard the range-check script and add the 2.8.0 highlight
The check-recent.sh recipe expanded git rev-list inside the for loop, so a failure produced an empty list and the script exited 0: run outside a repository, or against an unreadable revision, it reported success without checking anything. Resolve the revisions first and exit on failure. Add the missing 2.8.0 entry: it introduced message_pattern and dropped Python 3.9, which is the kind of change the highlights page exists for.
1 parent 532e370 commit fe8bc74

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

docs/example.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,14 @@ Nothing built in, but the exit code makes it a one-liner:
169169
```bash title="check-recent.sh"
170170
#!/usr/bin/env bash
171171
# Check the last N commit messages; exits non-zero if any fail.
172+
173+
# Resolved before the loop rather than inside it: an unreadable range or a
174+
# directory that is not a repository would otherwise expand to nothing, and
175+
# a loop that never runs would report success.
176+
shas=$(git rev-list -n "${1:-10}" HEAD) || exit 1
177+
172178
status=0
173-
for sha in $(git rev-list -n "${1:-10}" HEAD); do
179+
for sha in $shas; do
174180
if ! git log -1 --format=%B "$sha" | commit-check -m --compact; then
175181
echo " ↑ $sha"
176182
status=1

docs/what-is-new.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,21 @@ types, following
3535

3636
[:octicons-arrow-right-24: CC201](rules.md#cc201)
3737

38+
## 2.8.0 — Custom message patterns
39+
40+
`message_pattern` replaces the generated Conventional Commits regex with one of
41+
your own, for teams that already enforce a different format.
42+
43+
```toml title="cchk.toml"
44+
[commit]
45+
message_pattern = "^PROJ-\\d+: .+"
46+
```
47+
48+
This release also dropped Python 3.9. The minimum is now 3.10.
49+
50+
[:octicons-arrow-right-24: CC001](rules.md#cc001) ·
51+
[Configuration](configuration.md)
52+
3853
## 2.7.0 — Force push blocking
3954

4055
A `pre-push` hook that refuses a force push to a shared branch, plus a

0 commit comments

Comments
 (0)