Repository navigation
Support hook side effects without stashing repository changes - #939
Merged
Merged
Conversation
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.
Pre-commit and commit-msg hooks can now modify, create, remove, and stage files without losing their changes during cleanup. Unstaged edits are saved to a durable binary patch and hidden with a reverse application; cleanup reapplies that patch without changing HEAD, the index, the stash, or merge/cherry-pick metadata. Hooks retain native Git behavior: only edits they explicitly stage enter the commit, and their edits survive failed or interrupted runs.
If restoration conflicts with hook edits, the commit fails while preserving both the hook changes and a patch with recovery instructions. Patches survive garbage collection and forced termination, and successful cleanup removes them. File modification times are restored for unchanged files while hook edits remain visible to watchers.
The existing behavior tests remain, including deletion/rename and configuration-error recovery regressions. Tests tied to stash commands and legacy stash emulation were replaced with patch failure and recovery tests. New regression coverage includes actual commits, first commits, hook failures/exceptions/interruptions, index changes, alternate indexes, worktrees, binary files, unusual paths, symlinks/type changes, CRLF conversion, executable modes, conflicting edits, and shell-safe recovery commands. Interrupt messages now describe patch recovery instead of pointing to the stash.
AGENTS.mdand contributor guidance require 100% line coverage; CI now enforces it after combining all shard/platform reports.Validation:
bundle exec overcommit --run: passed, including RuboCop.This removes the stash/reset mechanisms behind reports such as #65, #80, #135, #168, #372, #524, and #669. lint-staged's current backup/revert workflow still uses stashes and hard resets, so it was not copied.
Closes #238.