fix(hooks): honor pre-commit filenames in values-check & avoid set -e abort#63
Conversation
… abort values-check.sh read `git diff --cached --name-only` and, under `set -e`, the assignment aborted the script the moment grep matched nothing (e.g. when run via `pre-commit run --all-files` with nothing staged) — printing only the header and exiting 1. pre-commit already passes the matched values.yaml paths as arguments (pass_filenames defaults to true), so use "$@" when present and fall back to staged files otherwise. Add `|| true` so an empty match no longer trips `set -e`. Behaviour verified for: args passed, staged-only, clean tree (graceful skip), and invalid YAML (still rejected).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe ChangesPre-commit hook argument handling
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
values-check.sh read
git diff --cached --name-onlyand, underset -e, the assignment aborted the script the moment grep matched nothing (e.g. when run viapre-commit run --all-fileswith nothing staged) — printing only the header and exiting 1.pre-commit already passes the matched values.yaml paths as arguments (pass_filenames defaults to true), so use "$@" when present and fall back to staged files otherwise. Add
|| trueso an empty match no longer tripsset -e. Behaviour verified for: args passed, staged-only, clean tree (graceful skip), and invalid YAML (still rejected).Summary by CodeRabbit