aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object/commit.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2020-05-13 12:11:00 +0200
committerGitHub <noreply@github.com>2020-05-13 12:11:00 +0200
commit6f9eb4ef0f8b33763ba79a0ceaaf71dd6db6255a (patch)
treed1219883c236444ee791ddf378713050f2430a4a /plumbing/object/commit.go
parent568154cab87659b31c751678c7f7dc93fedf60af (diff)
parent08da9bb09f6046c7344f537fc4a819ed03d23f55 (diff)
downloadgo-git-6f9eb4ef0f8b33763ba79a0ceaaf71dd6db6255a.tar.gz
Merge pull request #62 from mcuadros/commit-patch-nil
plumbing: object, Commit.Patch support to as nil
Diffstat (limited to 'plumbing/object/commit.go')
-rw-r--r--plumbing/object/commit.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/plumbing/object/commit.go b/plumbing/object/commit.go
index b27f20b..113cb29 100644
--- a/plumbing/object/commit.go
+++ b/plumbing/object/commit.go
@@ -87,9 +87,12 @@ func (c *Commit) PatchContext(ctx context.Context, to *Commit) (*Patch, error) {
return nil, err
}
- toTree, err := to.Tree()
- if err != nil {
- return nil, err
+ var toTree *Tree
+ if to != nil {
+ toTree, err = to.Tree()
+ if err != nil {
+ return nil, err
+ }
}
return fromTree.PatchContext(ctx, toTree)