@@ -6,7 +6,8 @@ A Go library for parsing and applying patches generated by `git diff`, `git
6
6
show` , and ` git format-patch`. It can also parse and apply unified diffs
7
7
generated by the standard ` diff ` tool.
8
8
9
- It supports both standard line-oriented text patches and Git binary patches.
9
+ It supports standard line-oriented text patches and Git binary patches, and
10
+ aims to parse anything accepted by the ` git apply ` command.
10
11
11
12
``` golang
12
13
patch , err := os.Open (" changes.patch" )
@@ -23,11 +24,11 @@ if err != nil {
23
24
// preamble is a string of the content of the patch before the first file
24
25
```
25
26
26
- ## Status
27
+ ## Development Status
27
28
28
- In development, expect API changes. Patch parsing works, but has not been
29
- tested extensively against real-world patches. Patch application has not been
30
- implemented yet .
29
+ Mostly complete, but API changes are possible . Patch parsing and strict
30
+ application works and is well-covered by unit tests, but has not been validated
31
+ extensively against real-world patches .
31
32
32
33
## Why another git/unified diff parser?
33
34
@@ -75,3 +76,8 @@ implemented yet.
75
76
5 . When reading "traditional" patches (those not produced by ` git ` ), prefixes
76
77
are not stripped from file names; ` git apply ` attempts to remove prefixes
77
78
that match the current repository directory/prefix.
79
+
80
+ 6 . Patches can only be applied in "strict" mode, where the line numbers and
81
+ context of each fragment must exactly match the source file; ` git apply `
82
+ implements a search algorithm that tries different lines and amounts of
83
+ context, with further options to normalize or ignore whitespace changes.
0 commit comments