MCPcopy Create free account
hub / github.com/go-git/go-git / PatchContext

Method PatchContext

plumbing/object/commit.go:100–115  ·  view source on GitHub ↗

PatchContext returns the Patch between the actual commit and the provided one. Error will be return if context expires. Provided context must be non-nil. NOTE: Since version 5.1.0 the renames are correctly handled, the settings used are the recommended options DefaultDiffTreeOptions.

(ctx context.Context, to *Commit)

Source from the content-addressed store, hash-verified

98// NOTE: Since version 5.1.0 the renames are correctly handled, the settings
99// used are the recommended options DefaultDiffTreeOptions.
100func (c *Commit) PatchContext(ctx context.Context, to *Commit) (*Patch, error) {
101 fromTree, err := c.Tree()
102 if err != nil {
103 return nil, err
104 }
105
106 var toTree *Tree
107 if to != nil {
108 toTree, err = to.Tree()
109 if err != nil {
110 return nil, err
111 }
112 }
113
114 return fromTree.PatchContext(ctx, toTree)
115}
116
117// Patch returns the Patch between the actual commit and the provided one.
118//

Callers 1

PatchMethod · 0.95

Calls 2

TreeMethod · 0.95
TreeMethod · 0.65

Tested by

no test coverage detected