mirror of
https://github.com/bluekeyes/go-gitdiff
synced 2026-06-08 13:18:30 +00:00
Add note about stricter checks for invalid input
This commit is contained in:
@@ -4,6 +4,8 @@ A Go library for parsing and applying patches generated by `git diff`, `git
|
||||
show`, and `git format-patch`. It can also parse and apply unified diffs
|
||||
generated by the standard `diff` tool.
|
||||
|
||||
It supports both standard line-oriented / text patches and Git binary patches.
|
||||
|
||||
## Status
|
||||
|
||||
In development, most functionality is currently missing, incomplete, or broken.
|
||||
@@ -20,12 +22,19 @@ In development, most functionality is currently missing, incomplete, or broken.
|
||||
2. Most other packages only parse patches, so you need another package to apply
|
||||
them (and if they do support applies, it is only for text files.)
|
||||
|
||||
3. This package aims to accept anything that `git apply` accepts, and closely
|
||||
follows the logic in [`apply.c`](https://github.com/git/git/blob/master/apply.c).
|
||||
3. This package aims to accept anything<sup id="a1">[1](#f1)</sup> that `git
|
||||
apply` accepts, and closely follows the logic in [`apply.c`][apply.c].
|
||||
|
||||
4. It seemed like a fun thing to write and a good way to learn more about Git.
|
||||
|
||||
<b id="f1">1:</b> In practice this library is stricter than `git apply` when
|
||||
given certain types of invalid input, particularly lines that contain garbage
|
||||
following the valid content. Git seems to ignore this, while this library will
|
||||
usually return an error. [↩](#a1)
|
||||
|
||||
[sourcegraph]: https://github.com/sourcegraph/go-diff
|
||||
[sergi]: https://github.com/sergi/go-diff
|
||||
[waigani]: https://github.com/waigani/diffparser
|
||||
[seletskiy]: https://github.com/seletskiy/godiff
|
||||
|
||||
[apply.c]: https://github.com/git/git/blob/master/apply.c
|
||||
|
||||
Reference in New Issue
Block a user