mirror of
https://github.com/bluekeyes/go-gitdiff
synced 2026-06-08 13:18:30 +00:00
Update status and add example in README
This commit is contained in:
@@ -1,14 +1,33 @@
|
||||
# go-gitdiff
|
||||
|
||||
[](http://godoc.org/github.com/bluekeyes/go-gitdiff/gitdiff)
|
||||
|
||||
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.
|
||||
It supports both standard line-oriented text patches and Git binary patches.
|
||||
|
||||
```golang
|
||||
patch, err := os.Open("changes.patch")
|
||||
if err != nil {
|
||||
log.Fatalf(err)
|
||||
}
|
||||
|
||||
files, preamble, err := gitdiff.Parse(patch)
|
||||
if err != nil {
|
||||
log.Fatalf(err)
|
||||
}
|
||||
|
||||
// files is a slice of *gitdiff.File describing the files changed in the patch
|
||||
// preamble is a string of the content of the patch before the first file
|
||||
```
|
||||
|
||||
## Status
|
||||
|
||||
In development, most functionality is currently missing, incomplete, or broken.
|
||||
In development, expect API changes. Patch parsing works, but has not been
|
||||
tested extensively against real-world patches. Patch application has not been
|
||||
implemented yet.
|
||||
|
||||
## Why another git/unified diff parser?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user