sync: state whether duplicates are objects are directories

This commit is contained in:
Nick Craig-Wood 2017-07-08 15:42:18 +01:00
parent 9ac72ee53f
commit 72add5ab27
2 changed files with 14 additions and 2 deletions

View File

@ -590,6 +590,18 @@ func (ds DirEntries) ForDirError(fn func(dir Directory) error) error {
return nil
}
// DirEntryType returns a string description of the DirEntry, either
// "object", "directory" or "unknown type XXX"
func DirEntryType(d DirEntry) string {
switch d.(type) {
case Object:
return "object"
case Directory:
return "directory"
}
return fmt.Sprintf("unknown type %T", d)
}
// ListDirSorted reads Object and *Dir into entries for the given Fs.
//
// dir is the start directory, "" for root

View File

@ -866,7 +866,7 @@ func matchListings(srcList, dstList DirEntries) (srcOnly DirEntries, dstOnly Dir
if src != nil && iSrc > 0 {
prev := srcList[iSrc-1].Remote()
if srcRemote == prev {
Logf(src, "Duplicate file found in source - ignoring")
Logf(src, "Duplicate %s found in source - ignoring", DirEntryType(src))
src = nil // ignore the src
} else if srcRemote < prev {
Errorf(src, "Out of order listing in source")
@ -876,7 +876,7 @@ func matchListings(srcList, dstList DirEntries) (srcOnly DirEntries, dstOnly Dir
if dst != nil && iDst > 0 {
prev := dstList[iDst-1].Remote()
if dstRemote == prev {
Logf(dst, "Duplicate file found in destination - ignoring")
Logf(dst, "Duplicate %s found in destination - ignoring", DirEntryType(dst))
dst = nil // ignore the dst
} else if dstRemote < prev {
Errorf(dst, "Out of order listing in destination")