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)
| 98 | // NOTE: Since version 5.1.0 the renames are correctly handled, the settings |
| 99 | // used are the recommended options DefaultDiffTreeOptions. |
| 100 | func (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 | // |