aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object/change.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2017-05-23 15:38:54 +0200
committerGitHub <noreply@github.com>2017-05-23 15:38:54 +0200
commitf663a9384619965ed8df7a7224e6f15ad18ed4af (patch)
tree337a4615e7a3ef24f46cbe008944a687c6a964ac /plumbing/object/change.go
parent2ff77a8d93529cefdca922dbed89d4b1cd0ee8e5 (diff)
parent65416cf6c0e8264cc7938fe0611998d52780e089 (diff)
downloadgo-git-f663a9384619965ed8df7a7224e6f15ad18ed4af.tar.gz
Merge pull request #388 from ajnavarro/feature/commit-diff
format/diff: unified diff encoder and public API
Diffstat (limited to 'plumbing/object/change.go')
-rw-r--r--plumbing/object/change.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/plumbing/object/change.go b/plumbing/object/change.go
index 2f702e4..729ff5a 100644
--- a/plumbing/object/change.go
+++ b/plumbing/object/change.go
@@ -78,6 +78,12 @@ func (c *Change) String() string {
return fmt.Sprintf("<Action: %s, Path: %s>", action, c.name())
}
+// Patch returns a Patch with all the file changes in chunks. This
+// representation can be used to create several diff outputs.
+func (c *Change) Patch() (*Patch, error) {
+ return getPatch("", c)
+}
+
func (c *Change) name() string {
if c.From != empty {
return c.From.Name
@@ -126,3 +132,9 @@ func (c Changes) String() string {
return buffer.String()
}
+
+// Patch returns a Patch with all the changes in chunks. This
+// representation can be used to create several diff outputs.
+func (c Changes) Patch() (*Patch, error) {
+ return getPatch("", c...)
+}