add proper constants for node type

This commit is contained in:
Michael Eischer 2024-07-09 19:51:44 +02:00
parent 3b438e5c7c
commit ca1e5e10b6
42 changed files with 206 additions and 206 deletions

View file

@ -67,7 +67,7 @@ func sendNodes(ctx context.Context, repo restic.BlobLoader, root *restic.Node, c
}
// If this is no directory we are finished
if !IsDir(root) {
if root.Type != restic.NodeTypeDir {
return nil
}
@ -81,7 +81,7 @@ func sendNodes(ctx context.Context, repo restic.BlobLoader, root *restic.Node, c
node.Path = path.Join(root.Path, nodepath)
if !IsFile(node) && !IsDir(node) && !IsLink(node) {
if node.Type != restic.NodeTypeFile && node.Type != restic.NodeTypeDir && node.Type != restic.NodeTypeSymlink {
return nil
}
@ -176,18 +176,3 @@ func (d *Dumper) writeNode(ctx context.Context, w io.Writer, node *restic.Node)
return wg.Wait()
}
// IsDir checks if the given node is a directory.
func IsDir(node *restic.Node) bool {
return node.Type == "dir"
}
// IsLink checks if the given node as a link.
func IsLink(node *restic.Node) bool {
return node.Type == "symlink"
}
// IsFile checks if the given node is a file.
func IsFile(node *restic.Node) bool {
return node.Type == "file"
}