next #44

Open
sneak wants to merge 78 commits from next into main
Showing only changes of commit e480c3f677 - Show all commits

View File

@ -156,22 +156,25 @@ func (m *manifest) addFile(p string, fi fs.FileInfo, sfsIndex int) error {
if !m.scanOptions.IncludeDotfiles && pathIsHidden(p) { if !m.scanOptions.IncludeDotfiles && pathIsHidden(p) {
return nil return nil
} }
if fi != nil && fi.IsDir() { if fi == nil {
// fi should come from Walk; if nil, stat to get info
var err error
fi, err = m.sourceFS[sfsIndex].Stat(p)
if err != nil {
return err
}
}
if fi.IsDir() {
// manifests contain only files, directories are implied. // manifests contain only files, directories are implied.
return nil return nil
} }
// FIXME test if 'fi' is already result of stat
fileinfo, staterr := m.sourceFS[sfsIndex].Stat(p)
if staterr != nil {
return staterr
}
cleanPath := p cleanPath := p
if cleanPath[0:1] == "/" { if cleanPath[0:1] == "/" {
cleanPath = cleanPath[1:] cleanPath = cleanPath[1:]
} }
nf := &manifestFile{ nf := &manifestFile{
path: cleanPath, path: cleanPath,
info: fileinfo, info: fi,
} }
m.files = append(m.files, nf) m.files = append(m.files, nf)
m.totalFileSize = m.totalFileSize + fi.Size() m.totalFileSize = m.totalFileSize + fi.Size()