fix(hooks): robust done-claim diff summary#23
Merged
Conversation
Replace 'git diff --stat HEAD~1' in stop-done-claim.sh, which produced empty or misleading evidence for the validator in four cases: - unborn HEAD (first commit not yet made) - root commit (no parent: HEAD~1 errors) - multi-commit task (only the last commit was shown) - uncommitted work (HEAD~1 ignores the working tree) Add build_diff_summary() to hooks/lib/common.sh: shows staged work on an unborn HEAD, uncommitted changes vs HEAD, and the whole branch since it forked from the default branch (origin/main, main, or master), falling back to HEAD~1 then the single commit. All 117 bats tests still pass.
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.
What
stop-done-claim.shusedgit diff --stat HEAD~1for the validator's evidence. It failed in four cases:HEAD~1errors, empty.HEAD~1ignores the working tree.Change
Add
build_diff_summary()tohooks/lib/common.sh. It shows staged work on an unborn HEAD, uncommitted changes vs HEAD, and the whole branch since it forked from the default branch (origin/main→main→master), falling back toHEAD~1then the single commit.Verification
bash -nclean; 117/117 bats tests pass.