Repository navigation
Pass --no-renames from Diff unless detection is requested, matching Patch [patch] - #180
Merged
Merged
Conversation
…atch [patch] Git defaults diff.renames to true, so Diff() reported a git mv as a rename without DetectRenames(), could not have detection turned off, reported copies under diff.renames=copies, and disagreed with Patch(), which already pins rename detection explicitly. Fixes #136 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GUKjHWJy9iwpdVJ1NKRU1M
|
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.



Fixes #136
What changed
DetectRenames()norDetectCopies()is called,GitDiffBuildernow passes--no-renames. Git has defaulteddiff.renamesto true since 2.9, and that default meant four problems:DetectRenames()did nothing.diff.renames=copiesproduced copy entries no caller asked for.Diff()andPatch()disagreed on agit mv.Patch()was already pinned this way by GitPatchBuilder doesn't pin context lines or rename detection, so host diff.context=0 yields patches Apply can't stage #121.DetectRenames()/DetectCopies()XML docs now say detection is off unless requested, whateverdiff.renamesis set to. This matchesIGitPatchBuilder.DetectRenames.DetectRenames()and/orDetectCopies()is called, the arguments are the same as before.Tests
GitPatchRoundTripTests.DiffReportsAStagedRenameAsPatchDoesWhateverTheHostsDiffRenamesAsyncruns against real git withdiff.renamesset totrue,falseandcopies. It checks three things:DetectRenames(),Diff().Staged()returns the same Added and Deleted entries asPatch().Staged().DetectRenames(), it returnsRenamed old.txt -> new.txt.GitDiffBuilderTests.TurnsRenameDetectionOffUnlessRequestedis a new test, andBuildsTheDefaultDiffVectorhas been updated.With the fix temporarily reverted, the unit tests and the
trueandcopiesrows fail. Thefalserow passes either way, which is expected. With the fix in place, the full suite passes locally on Linux: 737/737.🤖 Generated with Claude Code
https://claude.ai/code/session_01GUKjHWJy9iwpdVJ1NKRU1M
Generated by Claude Code