forked from TrueCloudLab/restic
Only test once if node type is still the same
This commit is contained in:
parent
248e3218cb
commit
5691d89822
1 changed files with 4 additions and 4 deletions
8
tree.go
8
tree.go
|
@ -130,12 +130,12 @@ func (t Tree) CopyFrom(bl *BlobList, other Tree, otherBl *BlobList) error {
|
||||||
// find entry in other tree
|
// find entry in other tree
|
||||||
oldNode, err := other.Find(node.Name)
|
oldNode, err := other.Find(node.Name)
|
||||||
|
|
||||||
// if the node could not be found, proceed to the next
|
// if the node could not be found or the type has changed, proceed to the next
|
||||||
if err == ErrNodeNotFound {
|
if err == ErrNodeNotFound || node.Type != oldNode.Type {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if node.Type == "file" && oldNode.Type == "file" {
|
if node.Type == "file" {
|
||||||
// compare content
|
// compare content
|
||||||
if node.SameContent(oldNode) {
|
if node.SameContent(oldNode) {
|
||||||
// copy Content
|
// copy Content
|
||||||
|
@ -151,7 +151,7 @@ func (t Tree) CopyFrom(bl *BlobList, other Tree, otherBl *BlobList) error {
|
||||||
bl.Insert(blob)
|
bl.Insert(blob)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if node.Type == "dir" && oldNode.Type == "dir" {
|
} else if node.Type == "dir" {
|
||||||
// fill in all subtrees from old subtree
|
// fill in all subtrees from old subtree
|
||||||
err := node.tree.CopyFrom(bl, *oldNode.tree, otherBl)
|
err := node.tree.CopyFrom(bl, *oldNode.tree, otherBl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue