aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object/tree.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2020-04-25 12:36:40 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2020-04-25 12:36:40 +0200
commit042e56e56e644bc9f02780dbf6eeadc40eb57f6a (patch)
treeb384712a73068ae5f4945385fac7b45752f6dd7c /plumbing/object/tree.go
parentc9533a6f9f3a6edd0fb7c8c161d4016a6af26bc3 (diff)
downloadgo-git-042e56e56e644bc9f02780dbf6eeadc40eb57f6a.tar.gz
plumbing: object, make renames diff default
Diffstat (limited to 'plumbing/object/tree.go')
-rw-r--r--plumbing/object/tree.go35
1 files changed, 20 insertions, 15 deletions
diff --git a/plumbing/object/tree.go b/plumbing/object/tree.go
index d3c8c77..5e6378c 100644
--- a/plumbing/object/tree.go
+++ b/plumbing/object/tree.go
@@ -304,29 +304,34 @@ func (t *Tree) buildMap() {
}
// Diff returns a list of changes between this tree and the provided one
-func (from *Tree) Diff(to *Tree) (Changes, error) {
- return DiffTree(from, to)
+func (t *Tree) Diff(to *Tree) (Changes, error) {
+ return t.DiffContext(context.Background(), to)
}
-// Diff returns a list of changes between this tree and the provided one
-// Error will be returned if context expires
-// Provided context must be non nil
-func (from *Tree) DiffContext(ctx context.Context, to *Tree) (Changes, error) {
- return DiffTreeContext(ctx, from, to)
+// DiffContext returns a list of changes between this tree and the provided one
+// Error will be returned 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.
+func (t *Tree) DiffContext(ctx context.Context, to *Tree) (Changes, error) {
+ return DiffTreeWithOptions(ctx, t, to, DefaultDiffTreeOptions)
}
// Patch returns a slice of Patch objects with all the changes between trees
// in chunks. This representation can be used to create several diff outputs.
-func (from *Tree) Patch(to *Tree) (*Patch, error) {
- return from.PatchContext(context.Background(), to)
+func (t *Tree) Patch(to *Tree) (*Patch, error) {
+ return t.PatchContext(context.Background(), to)
}
-// Patch returns a slice of Patch objects with all the changes between trees
-// in chunks. This representation can be used to create several diff outputs.
-// If context expires, an error will be returned
-// Provided context must be non-nil
-func (from *Tree) PatchContext(ctx context.Context, to *Tree) (*Patch, error) {
- changes, err := DiffTreeContext(ctx, from, to)
+// PatchContext returns a slice of Patch objects with all the changes between
+// trees in chunks. This representation can be used to create several diff
+// outputs. If context expires, an error will be returned. 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.
+func (t *Tree) PatchContext(ctx context.Context, to *Tree) (*Patch, error) {
+ changes, err := t.DiffContext(ctx, to)
if err != nil {
return nil, err
}