test: fix graft clobber-guard test on unsigned commits (CI)#12
Open
flipvh wants to merge 1 commit into
Open
Conversation
The 'never clobbers an existing replacement' test grafted HEAD onto its own existing parent to create the pre-existing replacement. With commit signing off (CI default), that produces a byte-identical commit and git refuses with 'new commit is the same as the old one'. It only passed locally because commit.gpgsign was on, so stripping the signature made the replacement differ. Graft onto a fabricated orphan commit as an extra parent instead, so the replacement object always differs regardless of signing. The orphan keeps upstreamBlockSha unreachable, so the helper still exercises the existing-replacement guard rather than the native-ancestor guard. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Problem
The
withTemporarySyncBaseGrafttest "never clobbers an existing replacement object on the HEAD commit" (added in #10) fails in CI:The test built its pre-existing replacement by grafting HEAD onto its own existing parent. That yields a byte-identical commit — which git refuses. It passed locally only because
commit.gpgsign=true: stripping the signature during graft made the replacement differ. CI signs nothing, so the objects were identical.This is purely a test-fixture issue; the
withTemporarySyncBaseGrafthelper is unaffected (its production graft always addsbaseShaas a new parent, so it never produces an identical object).Fix
Build the pre-existing replacement by grafting HEAD onto its existing parent plus a fabricated orphan commit (
git commit-treewith a unique message, no parent). The extra parent guarantees the replacement object differs regardless of signing, and the orphan leavesupstreamBlockShaunreachable — so the test still exercises the existing-replacement guard rather than the native-ancestor guard.Validation
GIT_CONFIG_GLOBAL=/dev/null GIT_CONFIG_SYSTEM=/dev/null(unsigned commits) → failed before, passes after.🤖 Generated with Claude Code