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

@ -22,6 +22,7 @@ import Utility.Split
import Data.Default
import System.FilePath.Posix
import qualified Data.List.NonEmpty as NE
type RsyncUrl = String
@ -42,7 +43,7 @@ mkRsyncUrl :: RsyncOpts -> FilePath -> RsyncUrl
mkRsyncUrl o f = rsyncUrl o </> rsyncEscape o f
rsyncUrls :: RsyncOpts -> Key -> [RsyncUrl]
rsyncUrls o k = map use dirHashes
rsyncUrls o k = map use (NE.toList dirHashes)
where
use h = rsyncUrl o </> hash h </> rsyncEscape o (f </> f)
f = fromRawFilePath (keyFile k)