Skip to content

chore: pre-commit hook to reject oversized files, ignore Testing/ - #121

Merged
jll63 merged 2 commits into
boostorg:developfrom
jll63:chore/pre-commit-size-hook
Sep 19, 2026
Merged

jll63 merged 2 commits into
boostorg:developfrom
jll63:chore/pre-commit-size-hook

Conversation

@jll63

@jll63 jll63 commented Sep 19, 2026

Copy link
Copy Markdown
Collaborator

(Written by Claude Code, on behalf of @jll63.)

Adds a size limit on committed files: a local pre-commit hook (opt-in), and
a CI job that enforces the same limit server-side so it isn't bypassable by
skipping local setup or by --no-verify. Also ignores CTest's stray
Testing/ output at the repo root.

  • dev/check-blob-size <oid> <path> - the check itself: rejects a blob over
    256 KiB. Shared by the hook and the CI job, so the limit and the message
    live in one place.
  • dev/git-hooks/pre-commit - runs the check over every file staged for a
    commit, sized from the index (git cat-file -s :path) so it's correct for
    partial stages (git add -p) and for git commit <paths> (git hands the
    hook a temporary index). Bypass with git commit --no-verify when a large
    file genuinely belongs.
  • dev/install-git-hooks - symlinks everything under dev/git-hooks/ into
    the hooks directory git actually runs. Resolved via
    git rev-parse --git-path hooks, so one run also covers every linked
    worktree of a clone, not just the one it's run from.
  • CI job "File size" - re-runs the same check over every blob any commit
    in a pull request introduces, not just the files that differ in the final
    base...head diff. A commit that adds an oversized file and a later commit
    in the same PR that shrinks or removes it again still leaves that blob in
    history forever once merged; checking only the net diff would miss it.
    This is what actually makes the limit non-optional - the local hook is a
    convenience, this is the enforcement.
  • .gitignore - ignore Testing/, which ctest writes at the repo root
    (Testing/Temporary/{LastTest.log,CTestCostData.txt}) whenever it's run
    from there rather than from build/.

🤖 Generated with Claude Code

jll63 and others added 2 commits September 18, 2026 20:43
Add a pre-commit hook (dev/git-hooks/pre-commit) that rejects a commit
staging any file over 256 KiB, sized from the index so it works with
partial stages and with `git commit <paths>`. It is not installed
automatically; dev/install-git-hooks symlinks it (and anything else
under dev/git-hooks/) into the hooks directory git actually runs -
.git/hooks in a plain clone, or the common git dir for a linked
worktree, so one run covers every worktree of a clone. Bypass with
`git commit --no-verify` when a large file is genuinely project
content.

Also ignore Testing/, which `ctest` writes at the repo root
(Testing/Temporary/{LastTest.log,CTestCostData.txt}) whenever it's
run from there rather than from build/.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The local pre-commit hook is opt-in - nothing forces a contributor to run
dev/install-git-hooks, and it's `--no-verify`-bypassable regardless. Add a
"File size" CI job that re-checks the same 256 KiB limit server-side, over
every blob any commit in the pull request introduces (not just the files
that differ in the final base...head diff), so an oversized file can't
reach develop even if the local hook never ran. A commit that adds a large
file and a later commit in the same PR that shrinks or removes it again is
still a permanent addition to history once merged - checking only the net
diff would miss it, and checking every commit's blobs catches it.

Extract the size check itself into dev/check-blob-size, shared by the hook
and the CI job so the limit and the message live in one place.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@cppalliance-bot

cppalliance-bot commented Sep 19, 2026

Copy link
Copy Markdown

An automated preview of the documentation is available at https://121.openmethod.prtest3.cppalliance.org/libs/openmethod/doc/html/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-09-19 00:57:21 UTC

@jll63
jll63 merged commit 08a6dee into boostorg:develop Sep 19, 2026
53 of 54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants