mirror of
https://github.com/vbatts/go-mtree.git
synced 2025-07-04 06:38:30 +00:00
*: make Keyword and KeyVal pervasive
Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
This commit is contained in:
parent
5d26726bb1
commit
4eec68be4b
18 changed files with 434 additions and 367 deletions
14
check.go
14
check.go
|
@ -6,16 +6,20 @@ package mtree
|
|||
//
|
||||
// This is equivalent to creating a new DirectoryHierarchy with Walk(root, nil,
|
||||
// keywords) and then doing a Compare(dh, newDh, keywords).
|
||||
func Check(root string, dh *DirectoryHierarchy, keywords []string) ([]InodeDelta, error) {
|
||||
func Check(root string, dh *DirectoryHierarchy, keywords []Keyword) ([]InodeDelta, error) {
|
||||
if keywords == nil {
|
||||
keywords = dh.UsedKeywords()
|
||||
used := 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)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// TODO: Handle tar_time, if necessary.
|
||||
return Compare(dh, newDh, keywords)
|
||||
}
|
||||
|
@ -23,9 +27,9 @@ func Check(root string, dh *DirectoryHierarchy, keywords []string) ([]InodeDelta
|
|||
// TarCheck is the tar equivalent of checking a file hierarchy spec against a
|
||||
// tar stream to determine if files have been changed. This is precisely
|
||||
// equivalent to Compare(dh, tarDH, keywords).
|
||||
func TarCheck(tarDH, dh *DirectoryHierarchy, keywords []string) ([]InodeDelta, error) {
|
||||
func TarCheck(tarDH, dh *DirectoryHierarchy, keywords []Keyword) ([]InodeDelta, error) {
|
||||
if keywords == nil {
|
||||
keywords = dh.UsedKeywords()
|
||||
return Compare(dh, tarDH, dh.UsedKeywords())
|
||||
}
|
||||
return Compare(dh, tarDH, keywords)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue