Problem statement
The generated pre-commit hook runs with Bash strict mode and dereferences an empty staged-file array. Metadata-only commits or hook invocations with no staged paths can therefore fail before the hook performs any useful validation.
Desired outcome
Generated hooks accept an empty staged-file list while preserving all existing environment-file protections.
Scope
- Expand the staged-file array safely when it is empty.
- Ignore the fallback empty entry.
- Add a generated-repository smoke test that invokes the hook with no staged files.
Acceptance criteria
Security implications
The change must not weaken the hook's rejection of committed environment files.
Documentation implications
None; this restores the documented hook behavior.
Problem statement
The generated pre-commit hook runs with Bash strict mode and dereferences an empty staged-file array. Metadata-only commits or hook invocations with no staged paths can therefore fail before the hook performs any useful validation.
Desired outcome
Generated hooks accept an empty staged-file list while preserving all existing environment-file protections.
Scope
Acceptance criteria
Security implications
The change must not weaken the hook's rejection of committed environment files.
Documentation implications
None; this restores the documented hook behavior.