Don't push directories into the backup unless associated with a file
This commit is contained in:
parent
a7ca6b2e34
commit
68ab705aac
|
@ -773,11 +773,14 @@ func (fs *Filesystem) GetIncludedFiles(dir string, ignored []string) (*backup.In
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Only push files into the result array since archives can't create an empty directory within them.
|
||||||
|
if !e.IsDir() {
|
||||||
// Avoid unnecessary parsing if there are no ignored files, nothing will match anyways
|
// Avoid unnecessary parsing if there are no ignored files, nothing will match anyways
|
||||||
// so no reason to call the function.
|
// so no reason to call the function.
|
||||||
if len(ignored) == 0 || !i.MatchesPath(strings.TrimPrefix(sp, fs.Path()+"/")) {
|
if len(ignored) == 0 || !i.MatchesPath(strings.TrimPrefix(sp, fs.Path()+"/")) {
|
||||||
inc.Push(sp)
|
inc.Push(sp)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// We can't just abort if the path is technically ignored. It is possible there is a nested
|
// We can't just abort if the path is technically ignored. It is possible there is a nested
|
||||||
// file or folder that should not be excluded, so in this case we need to just keep going
|
// file or folder that should not be excluded, so in this case we need to just keep going
|
||||||
|
|
Loading…
Reference in New Issue
Block a user