-
Notifications
You must be signed in to change notification settings - Fork 26
Comparing changes
Open a pull request
base repository: bluekeyes/go-gitdiff
base: v0.7.3
head repository: bluekeyes/go-gitdiff
compare: master
- 9 commits
- 35 files changed
- 1 contributor
Commits on Jul 15, 2024
-
Return preamble when a patch has no files (#46)
While empty patches with only a header were parsable, the parser discarded the preamble content. This meant callers had to handle this case specially. Now, if we reach the end of the input without finding a file, Parse() returns the full content of the patch as the preamble.
Configuration menu - View commit details
-
Copy full SHA for 0a4e55f - Browse repository at this point
Copy the full SHA 0a4e55fView commit details
Commits on Aug 11, 2024
-
Update Go and golangci-lint versions (#49)
The minimum Go version for the package is now Go 1.21. This is because a future change will use the 'slices' package in test code. Note that non-test code in the package should still be compatible with older versions of Go. As part of this, also update the golangci-lint version to one that works with Go 1.21, which required replacing some deprecated linters.
Configuration menu - View commit details
-
Copy full SHA for 9e0997e - Browse repository at this point
Copy the full SHA 9e0997eView commit details -
Add String() methods to parsed types (#48)
This enables clients to move back and forth between parsed objects and text patches. The generated patches are semantically equal to the parsed object and should re-parse to the same object, but may not be byte-for-byte identical to the original input. In my testing, formatted text patches are usually identical to the input, but there may be cases where this is not true. Binary patches always differ. This is because Go's 'compress/flate' package ends streams with an empty block instead of adding the end-of-stream flag to the last non-empty block, like Git's C implementation. Since the streams will always be different for this reason, I chose to also enable default compression (the test patches I generated with Git used no compression.) The main tests for this feature involve parsing, formatting, and then re-parsing a patch to make sure we get equal objects. Formatting is handled by a new internal formatter type, which allows writing all data to the same stream. This isn't exposed publicly right now, but will be useful if there's a need for more flexible formatting functions in the future, like formatting to a user-provided io.Writer.
Configuration menu - View commit details
-
Copy full SHA for 8584cd5 - Browse repository at this point
Copy the full SHA 8584cd5View commit details
Commits on Jan 8, 2025
-
Parse binary headers with file paths (#55)
Some patches may include one or more file paths as part of the binary header when there is no binary data. Git accounts for this by only checking the prefix and suffix of the line, but I missed that logic when implementing this originally.
Configuration menu - View commit details
-
Copy full SHA for 14da3d3 - Browse repository at this point
Copy the full SHA 14da3d3View commit details -
Fix binary headers in formatted patches (#56)
Include file names in the header (now that we can actually parse them) and fix a bad find-and-replace that changed "differ" to "fmer". Add a new test to verify that binary files without data format correctly.
Configuration menu - View commit details
-
Copy full SHA for fffa3cc - Browse repository at this point
Copy the full SHA fffa3ccView commit details
Commits on Mar 5, 2025
-
Add a test for removing the last newline in a file (#59)
This worked, but completes the test coverage in combination with the test that adds a final newline and one that leaves the missing newline in place.
Configuration menu - View commit details
-
Copy full SHA for 823d31d - Browse repository at this point
Copy the full SHA 823d31dView commit details
Commits on Mar 29, 2025
-
Clarify that we only support GNU diff
In issue #57, it was reported that the library could not apply some patches generated by BSD `diff` because of the way that variant reports changes in files without trailing newlines. Since the library behavior matches Git, I don't consider this a bug, but update the README to mention that the support for standard unified diffs is only for the GNU variant of the `diff` tool.
Configuration menu - View commit details
-
Copy full SHA for 0896f01 - Browse repository at this point
Copy the full SHA 0896f01View commit details
Commits on Apr 1, 2025
-
Configuration menu - View commit details
-
Copy full SHA for 7413262 - Browse repository at this point
Copy the full SHA 7413262View commit details
Commits on Sep 4, 2025
-
Report short sources as conflicts during apply (#63)
Previously, this returned an io.ErrUnexpectedEOF. This is not wrong, in that we did unexpectedly hit the end of the input file, but it is vague and implies a possible library bug rather than a problem with the patch or the input. This condition is really a conflict, as the changes described by the patch are not compatible with the state of the input.
Configuration menu - View commit details
-
Copy full SHA for 17bd72f - Browse repository at this point
Copy the full SHA 17bd72fView commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff v0.7.3...master