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,14 +692,18 @@ func (ds *ncduSort) Less(i, j int) bool {
return iAvgSize < jAvgSize
}
// if avgSize is equal, sort by 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
if iattrs.Size != jattrs.Size {
return iattrs.Size > jattrs.Size
}
}
// if everything equal, sort by name
return iname < jname
}