use NonEmpty for dirHashes
This avoids 4 uses of head.
This commit is contained in:
parent
43f31121a5
commit
10216b44d2
8 changed files with 34 additions and 22 deletions
|
@ -1,4 +1,4 @@
|
|||
{- git-annex file locations
|
||||
{- git-annex object file locations
|
||||
-
|
||||
- Copyright 2010-2019 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
|
@ -19,6 +19,7 @@ module Annex.DirHashes (
|
|||
|
||||
import Data.Default
|
||||
import Data.Bits
|
||||
import qualified Data.List.NonEmpty as NE
|
||||
import qualified Data.ByteArray as BA
|
||||
import qualified Data.ByteArray.Encoding as BA
|
||||
import qualified Data.ByteString as S
|
||||
|
@ -60,8 +61,8 @@ branchHashDir = hashDirLower . branchHashLevels
|
|||
- To support that, some git-annex repositories use the lower case-hash.
|
||||
- All special remotes use the lower-case hash for new data, but old data
|
||||
- may still use the mixed case hash. -}
|
||||
dirHashes :: [HashLevels -> Hasher]
|
||||
dirHashes = [hashDirLower, hashDirMixed]
|
||||
dirHashes :: NE.NonEmpty (HashLevels -> Hasher)
|
||||
dirHashes = hashDirLower NE.:| [hashDirMixed]
|
||||
|
||||
hashDirs :: HashLevels -> Int -> S.ByteString -> RawFilePath
|
||||
hashDirs (HashLevels 1) sz s = P.addTrailingPathSeparator $ S.take sz s
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue