Fix wrong sorting of remotes when using -J

It was sorting by uuid, rather than cost!

Avoid future bugs of this kind by changing the Ord to primarily compare
by cost, with uuid only used when the cost is the same.

This commit was supported by the NSF-funded DataLad project.
This commit is contained in:
Joey Hess 2018-08-03 13:06:06 -04:00
parent 178ab762eb
commit 1a02fc1159
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 18 additions and 2 deletions

View file

@ -279,4 +279,4 @@ pickRemote l a = go l =<< Annex.getState Annex.concurrency
lessActiveFirst :: M.Map Remote Integer -> Remote -> Remote -> Ordering
lessActiveFirst active a b
| Remote.cost a == Remote.cost b = comparing (`M.lookup` active) a b
| otherwise = compare a b
| otherwise = comparing Remote.cost a b