Repository navigation
Keep a hunk header's length as the diff wrote it - #155
Closed
abhishekcpp007 wants to merge 1 commit into
Closed
abhishekcpp007 wants to merge 1 commit into
abhishekcpp007 wants to merge 1 commit into
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.
A hunk whose length is one loses its header form on the way back out.
diffandgitleave the length off in that case, and
str(PatchSet(...))puts it back:git diff -U0writes every hunk that way, so a patch read and written back is almostnever the same bytes. Over four repositories, 350 of 411
git show -U0diffs failed toround trip before this change and none fail after.
Hunk.__init__already seesNonefor a length the header left out, and turned it into1 without keeping the distinction. It now records it, and
__str__writes whichever formthe header used. A hunk built by hand still writes both lengths, so nothing changes for
code that constructs one.
73 tests passed before, 75 after.