From ba4db47e687663eb3cd0c9ccfaea0fb83b352851 Mon Sep 17 00:00:00 2001 From: Billy Keyes Date: Sat, 16 Mar 2019 15:54:41 -0700 Subject: [PATCH] Add note about stricter checks for invalid input --- README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index af9feaa..07603cf 100644 --- a/README.md +++ b/README.md @@ -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[1](#f1) 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. +1: 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