Skip to content

Let a checkout opt out of its repository's pre-commit configuration - #88

Merged
krystophny merged 1 commit into
mainfrom
hooks/repo-precommit-optout
Oct 30, 2026
Merged

krystophny merged 1 commit into
mainfrom
hooks/repo-precommit-optout

Conversation

@krystophny

Copy link
Copy Markdown
Member

The shared hook runs a repository's own .pre-commit-config.yaml (pre-commit#L74). Some upstream repositories ship one that their contributors never run. LFortran pins clang-format 13 with -i, so a 24-line fix to asr_to_wasm.cpp becomes a 2120-line reformat of the whole file.

A checkout can now opt out with git config hooks.repoPreCommit false; the hook then reports that it skipped the repository's checks. Hygiene and Fo checks still run, and repositories without the setting behave as before.

Checked in a scratch repository whose configuration records its run: unset and true run it, false skips it with the message. bash -n and shellcheck are clean.

Chris&AI

Upstream repositories such as LFortran ship a .pre-commit-config.yaml their contributors never run; its clang-format rewrites whole files, so every commit there would carry an unrelated reformat. hooks.repoPreCommit=false skips that configuration for one checkout.
@krystophny
krystophny added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit 9f7b71d Oct 30, 2026
1 check passed
@krystophny
krystophny deleted the hooks/repo-precommit-optout branch October 30, 2026 05:17
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.

1 participant