use NonEmpty for dirHashes

This avoids 4 uses of head.
This commit is contained in:
Joey Hess 2024-09-26 18:15:00 -04:00
parent 43f31121a5
commit 10216b44d2
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
8 changed files with 34 additions and 22 deletions

View file

@ -118,6 +118,7 @@ module Annex.Locations (
import Data.Char
import Data.Default
import qualified Data.List.NonEmpty as NE
import qualified Data.ByteString.Char8 as S8
import qualified System.FilePath.ByteString as P
@ -775,5 +776,5 @@ keyPath key hasher = hasher key P.</> f P.</> f
- This is compatible with the annexLocationsNonBare and annexLocationsBare,
- for interoperability between special remotes and git-annex repos.
-}
keyPaths :: Key -> [RawFilePath]
keyPaths key = map (\h -> keyPath key (h def)) dirHashes
keyPaths :: Key -> NE.NonEmpty RawFilePath
keyPaths key = NE.map (\h -> keyPath key (h def)) dirHashes