diff options
author | Joey Hess <joey@kitenet.net> | 2011-12-15 18:11:42 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-12-15 18:19:36 -0400 |
commit | 95d2391f58ae240e7100f0d5488dd7246f71f3bb (patch) | |
tree | f33f21904ae7be4d40b70bab1e2a68fd4eef5526 /Remote | |
parent | b7e0d39abbc9a09c21c6f0103ad6c9f4547f81fe (diff) |
more partial function removal
Left a few Prelude.head's in where it was checked not null and too hard to
remove, etc.
Diffstat (limited to 'Remote')
-rw-r--r-- | Remote/Bup.hs | 8 | ||||
-rw-r--r-- | Remote/Directory.hs | 2 | ||||
-rw-r--r-- | Remote/Rsync.hs | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/Remote/Bup.hs b/Remote/Bup.hs index 8bd484b7d..cbd5d584a 100644 --- a/Remote/Bup.hs +++ b/Remote/Bup.hs @@ -209,20 +209,20 @@ bup2GitRemote "" = do Git.Construct.fromAbsPath $ h </> ".bup" bup2GitRemote r | bupLocal r = - if head r == '/' + if "/" `isPrefixOf` r then Git.Construct.fromAbsPath r else error "please specify an absolute path" | otherwise = Git.Construct.fromUrl $ "ssh://" ++ host ++ slash dir where bits = split ":" r - host = head bits + host = Prelude.head bits dir = join ":" $ drop 1 bits -- "host:~user/dir" is not supported specially by bup; -- "host:dir" is relative to the home directory; -- "host:" goes in ~/.bup slash d - | d == "" = "/~/.bup" - | head d == '/' = d + | null d = "/~/.bup" + | "/" `isPrefixOf` d = d | otherwise = "/~/" ++ d bupLocal :: BupRepo -> Bool diff --git a/Remote/Directory.hs b/Remote/Directory.hs index a6077d813..7f78b2f49 100644 --- a/Remote/Directory.hs +++ b/Remote/Directory.hs @@ -96,7 +96,7 @@ storeEncrypted d (cipher, enck) k = do storeHelper :: FilePath -> Key -> (FilePath -> IO Bool) -> IO Bool storeHelper d key a = do - let dest = head $ locations d key + let dest = Prelude.head $ locations d key let dir = parentDir dest createDirectoryIfMissing True dir allowWrite dir diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs index 81107cb56..c28142077 100644 --- a/Remote/Rsync.hs +++ b/Remote/Rsync.hs @@ -188,7 +188,7 @@ rsyncRemote o params = do directories. -} rsyncSend :: RsyncOpts -> Key -> FilePath -> Annex Bool rsyncSend o k src = withRsyncScratchDir $ \tmp -> do - let dest = tmp </> head (keyPaths k) + let dest = tmp </> Prelude.head (keyPaths k) liftIO $ createDirectoryIfMissing True $ parentDir dest liftIO $ createLink src dest rsyncRemote o |