aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object/commit.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2020-05-24 14:34:30 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2020-05-24 14:34:30 +0200
commitd13825550a301d8e087122bbec87a2698424af27 (patch)
treefb9d3fdcde4981d89b32e2a3c98deddfc31d0527 /plumbing/object/commit.go
parenta107e18b9327e9a5da7a44b3a872b2f43598dfb4 (diff)
parent6d8103df45ce09ffd5323b4ef46d26440400a54f (diff)
downloadgo-git-d13825550a301d8e087122bbec87a2698424af27.tar.gz
Merge branch 'master' of github.com:go-git/go-git into scope-config
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)