aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object/commit.go
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing/object/commit.go')
-rw-r--r--plumbing/object/commit.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/plumbing/object/commit.go b/plumbing/object/commit.go
index c9a4c0e..3ed85ba 100644
--- a/plumbing/object/commit.go
+++ b/plumbing/object/commit.go
@@ -3,6 +3,7 @@ package object
import (
"bufio"
"bytes"
+ "context"
"errors"
"fmt"
"io"
@@ -75,7 +76,8 @@ func (c *Commit) Tree() (*Tree, error) {
}
// Patch returns the Patch between the actual commit and the provided one.
-func (c *Commit) Patch(to *Commit) (*Patch, error) {
+// Error will be return if context expires. Provided context must be non-nil
+func (c *Commit) PatchContext(ctx context.Context, to *Commit) (*Patch, error) {
fromTree, err := c.Tree()
if err != nil {
return nil, err
@@ -86,7 +88,12 @@ func (c *Commit) Patch(to *Commit) (*Patch, error) {
return nil, err
}
- return fromTree.Patch(toTree)
+ return fromTree.PatchContext(ctx, toTree)
+}
+
+// Patch returns the Patch between the actual commit and the provided one.
+func (c *Commit) Patch(to *Commit) (*Patch, error) {
+ return c.PatchContext(context.Background(), to)
}
// Parents return a CommitIter to the parent Commits.