mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-22 19:08:58 +00:00
Ensure dir before files ordering when scanning
This commit is contained in:
parent
681306b7a1
commit
99736e5066
@ -97,7 +97,7 @@ func (w *Walker) Walk() (chan protocol.FileInfo, error) {
|
||||
newParallelHasher(w.Dir, w.BlockSize, w.Hashers, hashedFiles, files)
|
||||
|
||||
go func() {
|
||||
hashFiles := w.walkAndHashFiles(files)
|
||||
hashFiles := w.walkAndHashFiles(files, hashedFiles)
|
||||
if len(w.Subs) == 0 {
|
||||
filepath.Walk(w.Dir, hashFiles)
|
||||
} else {
|
||||
@ -111,7 +111,7 @@ func (w *Walker) Walk() (chan protocol.FileInfo, error) {
|
||||
return hashedFiles, nil
|
||||
}
|
||||
|
||||
func (w *Walker) walkAndHashFiles(fchan chan protocol.FileInfo) filepath.WalkFunc {
|
||||
func (w *Walker) walkAndHashFiles(fchan, dchan chan protocol.FileInfo) filepath.WalkFunc {
|
||||
now := time.Now()
|
||||
return func(p string, info os.FileInfo, err error) error {
|
||||
// Return value used when we are returning early and don't want to
|
||||
@ -311,7 +311,7 @@ func (w *Walker) walkAndHashFiles(fchan chan protocol.FileInfo) filepath.WalkFun
|
||||
if debug {
|
||||
l.Debugln("dir:", p, f)
|
||||
}
|
||||
fchan <- f
|
||||
dchan <- f
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ func TestNormalization(t *testing.T) {
|
||||
func TestIssue1507(t *testing.T) {
|
||||
w := Walker{}
|
||||
c := make(chan protocol.FileInfo, 100)
|
||||
fn := w.walkAndHashFiles(c)
|
||||
fn := w.walkAndHashFiles(c, c)
|
||||
|
||||
fn("", nil, protocol.ErrClosed)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user