diff --git a/README.md b/README.md index 0713b44..1e24f87 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,33 @@ # go-gitdiff +[![GoDoc](https://godoc.org/github.com/bluekeyes/go-gitdiff/gitdiff?status.svg)](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?