File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change 1
1
# go-gitdiff
2
2
3
+ [ ![ GoDoc] ( https://godoc.org/github.com/bluekeyes/go-gitdiff/gitdiff?status.svg )] ( http://godoc.org/github.com/bluekeyes/go-gitdiff/gitdiff )
4
+
3
5
A Go library for parsing and applying patches generated by ` git diff ` , `git
4
6
show` , and ` git format-patch`. It can also parse and apply unified diffs
5
7
generated by the standard ` diff ` tool.
6
8
7
- It supports both standard line-oriented / text patches and Git binary patches.
9
+ It supports both standard line-oriented text patches and Git binary patches.
10
+
11
+ ``` golang
12
+ patch , err := os.Open (" changes.patch" )
13
+ if err != nil {
14
+ log.Fatalf (err)
15
+ }
16
+
17
+ files , preamble , err := gitdiff.Parse (patch)
18
+ if err != nil {
19
+ log.Fatalf (err)
20
+ }
21
+
22
+ // files is a slice of *gitdiff.File describing the files changed in the patch
23
+ // preamble is a string of the content of the patch before the first file
24
+ ```
8
25
9
26
## Status
10
27
11
- In development, most functionality is currently missing, incomplete, or broken.
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.
12
31
13
32
## Why another git/unified diff parser?
14
33
You can’t perform that action at this time.
0 commit comments