check: simplify Compare

Signed-off-by: Aleksa Sarai <asarai@suse.de>
This commit is contained in:
Aleksa Sarai 2016-12-14 16:24:02 +11:00
parent d42d5761a6
commit 98824a87da
No known key found for this signature in database
GPG key ID: 9E18AA267DDB8DB4

View file

@ -8,19 +8,14 @@ package mtree
// keywords) and then doing a Compare(dh, newDh, keywords). // keywords) and then doing a Compare(dh, newDh, keywords).
func Check(root string, dh *DirectoryHierarchy, keywords []Keyword) ([]InodeDelta, error) { func Check(root string, dh *DirectoryHierarchy, keywords []Keyword) ([]InodeDelta, error) {
if keywords == nil { if keywords == nil {
used := dh.UsedKeywords() keywords = dh.UsedKeywords()
newDh, err := Walk(root, nil, used)
if err != nil {
return nil, err
}
return Compare(dh, newDh, used)
} }
newDh, err := Walk(root, nil, keywords) newDh, err := Walk(root, nil, keywords)
if err != nil { if err != nil {
return nil, err return nil, err
} }
// TODO: Handle tar_time, if necessary.
return Compare(dh, newDh, keywords) return Compare(dh, newDh, keywords)
} }