aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object/change.go
diff options
context:
space:
mode:
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...)
+}