Skip to content

Commit 37fcc9a

Browse files
committed
Update status and add example in README
1 parent 31777bd commit 37fcc9a

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,33 @@
11
# go-gitdiff
22

3+
[![GoDoc](https://godoc.org/github.com/bluekeyes/go-gitdiff/gitdiff?status.svg)](http://godoc.org/github.com/bluekeyes/go-gitdiff/gitdiff)
4+
35
A Go library for parsing and applying patches generated by `git diff`, `git
46
show`, and `git format-patch`. It can also parse and apply unified diffs
57
generated by the standard `diff` tool.
68

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+
```
825

926
## Status
1027

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.
1231

1332
## Why another git/unified diff parser?
1433

0 commit comments

Comments
 (0)