MCPcopy Index your code
hub / github.com/go-git/go-git / PatchContext

Method PatchContext

plumbing/object/commit.go:154–169  ·  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

152// NOTE: Since version 5.1.0 the renames are correctly handled, the settings
153// used are the recommended options DefaultDiffTreeOptions.
154func (c *Commit) PatchContext(ctx context.Context, to *Commit) (*Patch, error) {
155 fromTree, err := c.Tree()
156 if err != nil {
157 return nil, err
158 }
159
160 var toTree *Tree
161 if to != nil {
162 toTree, err = to.Tree()
163 if err != nil {
164 return nil, err
165 }
166 }
167
168 return fromTree.PatchContext(ctx, toTree)
169}
170
171// Patch returns the Patch between the actual commit and the provided one.
172//

Callers 1

PatchMethod · 0.95

Calls 2

TreeMethod · 0.95
TreeMethod · 0.65

Tested by

no test coverage detected