mirror of
https://github.com/octoleo/restic.git
synced 2025-01-09 17:33:56 +00:00
Count non-regular files for progress as well
This commit is contained in:
parent
50f9c20987
commit
82139912e8
15
archiver.go
15
archiver.go
@ -503,7 +503,7 @@ func (j archiveJob) Copy() pipe.Job {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handle files
|
// handle files
|
||||||
if isFile(j.new.Info()) {
|
if isRegularFile(j.new.Info()) {
|
||||||
debug.Log("archiveJob.Copy", " job %v is file", j.new.Path())
|
debug.Log("archiveJob.Copy", " job %v is file", j.new.Path())
|
||||||
|
|
||||||
// if type has changed, return new job directly
|
// if type has changed, return new job directly
|
||||||
@ -649,7 +649,7 @@ func (arch *Archiver) Snapshot(p *Progress, paths []string, parentID backend.ID)
|
|||||||
return sn, id, nil
|
return sn, id, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func isFile(fi os.FileInfo) bool {
|
func isRegularFile(fi os.FileInfo) bool {
|
||||||
if fi == nil {
|
if fi == nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -679,11 +679,14 @@ func Scan(dirs []string, p *Progress) (Stat, error) {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
s := Stat{}
|
s := Stat{}
|
||||||
if isFile(fi) {
|
if fi.IsDir() {
|
||||||
s.Files++
|
|
||||||
s.Bytes += uint64(fi.Size())
|
|
||||||
} else if fi.IsDir() {
|
|
||||||
s.Dirs++
|
s.Dirs++
|
||||||
|
} else {
|
||||||
|
s.Files++
|
||||||
|
|
||||||
|
if isRegularFile(fi) {
|
||||||
|
s.Bytes += uint64(fi.Size())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p.Report(s)
|
p.Report(s)
|
||||||
|
Loading…
Reference in New Issue
Block a user