ncdu: fallback to sort by name also for sort by average size

This commit is contained in:
albertony 2022-11-04 12:08:41 +01:00 committed by Nick Craig-Wood
parent d452f502c3
commit 528fc899fb

View File

@ -692,13 +692,17 @@ func (ds *ncduSort) Less(i, j int) bool {
return iAvgSize < jAvgSize
}
// if avgSize is equal, sort by size
return iattrs.Size < jattrs.Size
if iattrs.Size != jattrs.Size {
return iattrs.Size < jattrs.Size
}
case ds.u.sortByAverageSize > 0:
if iAvgSize != jAvgSize {
return iAvgSize > jAvgSize
}
// if avgSize is equal, sort by size
return iattrs.Size > jattrs.Size
if iattrs.Size != jattrs.Size {
return iattrs.Size > jattrs.Size
}
}
// if everything equal, sort by name
return iname < jname