aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object/change.go
diff options
context:
space:
mode:
authorAntonio Jesus Navarro Perez <antnavper@gmail.com>2017-05-10 16:47:15 +0200
committerAntonio Jesus Navarro Perez <antnavper@gmail.com>2017-05-23 11:05:14 +0200
commit2f293f4a5214ccba5bdf0b82ff8b62ed39144078 (patch)
tree8942869ff31dbf3aa950c1d3cddb3a0de8ca0aa3 /plumbing/object/change.go
parent2ff77a8d93529cefdca922dbed89d4b1cd0ee8e5 (diff)
downloadgo-git-2f293f4a5214ccba5bdf0b82ff8b62ed39144078.tar.gz
format/diff: unified diff encoder and public API
- Added Patch interface - Added a Unified Diff encoder from Patches - Added Change method to generate Patches - Added Changes method to generate Patches - Added Tree method to generate Patches - Added Commit method to generate Patches
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...)
+}