From 08da9bb09f6046c7344f537fc4a819ed03d23f55 Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Wed, 13 May 2020 11:58:48 +0200 Subject: plumbing: object, Commit.Patch support to as nil --- plumbing/object/commit.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'plumbing/object/commit.go') 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) -- cgit