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