Skip to content

Comments

Fix: Prevent 'argument list too long' error in hooks#167

Merged
rycus86 merged 4 commits intomasterfrom
fix-arg-list-too-long
Aug 6, 2025
Merged

Fix: Prevent 'argument list too long' error in hooks#167
rycus86 merged 4 commits intomasterfrom
fix-arg-list-too-long

Conversation

@google-labs-jules
Copy link
Contributor

This change fixes an 'argument list too long' error that can occur when processing a large number of files in the git hooks. The fix involves setting the IFS variable to a newline in base-template.sh, which ensures that hook scripts can safely iterate over the list of staged files.

Set the IFS variable to a newline in base-template.sh.

This prevents the 'argument list too long' error when hook scripts iterate over the STAGED_FILES environment variable with a large number of files.

This change is made in the central `base-template.sh` script to avoid modifying numerous hook scripts, and to be robust for future hook scripts.
@coveralls
Copy link

coveralls commented Aug 6, 2025

Pull Request Test Coverage Report for Build 16791154733

Details

  • 8 of 8 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.04%) to 79.925%

Totals Coverage Status
Change from base Build 15129031835: 0.04%
Covered Lines: 2548
Relevant Lines: 3188

💛 - Coveralls

google-labs-jules bot and others added 3 commits August 6, 2025 20:04
I've set the IFS variable to a newline in base-template.sh.

This will prevent the 'argument list too long' error when hook scripts iterate over the STAGED_FILES environment variable with a large number of files.

I made this change in the central `base-template.sh` script to avoid modifying numerous hook scripts, and to be robust for future hook scripts.

I've also added a new test case (tests/step-101.sh) to verify the fix by committing a large number of files.
@rycus86 rycus86 marked this pull request as ready for review August 6, 2025 23:42
@rycus86 rycus86 merged commit b1b03d4 into master Aug 6, 2025
28 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