fix: disable lint-staged stash to prevent GPG-signed commit corruption - #2090
Open
gaspergrom wants to merge 1 commit into
Open
fix: disable lint-staged stash to prevent GPG-signed commit corruption#2090gaspergrom wants to merge 1 commit into
gaspergrom wants to merge 1 commit into
Conversation
…ng into deletions The pre-commit hook's final → No staged files match any configured task. step was silently turning GPG-signed commits (git commit -S) into pure deletions of every touched file — disk content stayed correct, but the recorded commit tree only contained deletions. Reproduced twice, deterministic under a real git commit -S but not when running the hook script standalone. lint-staged's stash-based backup/restore mechanism (visible in its own console output: backing up state, applying modifications, cleaning up) was racing with git's index handling during the commit transaction. The hook already force-stages every touched file via git add -u right before this step runs, so there's no partially-staged state left for the stash to protect — disabling it (--no-stash) removes the race entirely without changing what gets committed. Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Disables lint-staged’s stash mechanism to prevent corruption of GPG-signed commits.
Changes:
- Adds
--no-stashto the lint-staged invocation. - Documents why stashing is unnecessary and unsafe in this hook.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
npx lint-stagedstep was silently turning GPG-signed commits (git commit -S) into pure deletions of every touched file — disk content stayed correct, but the recorded commit tree only contained deletions. Reproduced twice, deterministic under a realgit commit -S, not reproducible running the hook script standalone.git add -uright before this step runs, so there's nothing partially-staged left for the stash to protect.--no-stashtonpx lint-staged, removing the race entirely.Test plan
mainwith a realgit commit -Stouchingfrontend/, confirmed viagit show --stat(pure deletions)--no-stash, repeated the same commit — confirmed correct tree viagit show --stat(real insertions/deletions, no data loss)git log --format='%G? %h %s'→G)