summaryrefslogtreecommitdiff
path: root/Remote/Bup.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-11-07 23:21:22 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-11-08 00:17:54 -0400
commitb11a63a860e8446cf3a4b35a5d8ef76329d5135c (patch)
treec8ae0c94d6473a3ccc7b15bdbc72d5b5c6ae96b3 /Remote/Bup.hs
parentfdf988be6d2b3bb931a9eb3dcf3fbb83b1fb8c17 (diff)
clean up read/show abuse
Avoid ever using read to parse a non-haskell formatted input string. show :: Key is arguably still show abuse, but displaying Keys as filenames is just too useful to give up.
Diffstat (limited to 'Remote/Bup.hs')
-rw-r--r--Remote/Bup.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/Remote/Bup.hs b/Remote/Bup.hs
index b613225b8..3e621ce56 100644
--- a/Remote/Bup.hs
+++ b/Remote/Bup.hs
@@ -161,13 +161,15 @@ storeBupUUID u buprepo = do
then do
showAction "storing uuid"
onBupRemote r boolSystem "git"
- [Params $ "config annex.uuid " ++ show u]
+ [Params $ "config annex.uuid " ++ v]
>>! error "ssh failed"
else liftIO $ do
r' <- Git.configRead r
let olduuid = Git.configGet r' "annex.uuid" ""
- when (olduuid == "") $
- Git.run r' "config" [Param "annex.uuid", Param $ show u]
+ when (olduuid == "") $ Git.run r' "config"
+ [Param "annex.uuid", Param v]
+ where
+ v = fromUUID u
onBupRemote :: Git.Repo -> (FilePath -> [CommandParam] -> IO a) -> FilePath -> [CommandParam] -> Annex a
onBupRemote r a command params = do
@@ -192,7 +194,7 @@ getBupUUID r u
| otherwise = liftIO $ do
ret <- try $ Git.configRead r
case ret of
- Right r' -> return (read $ Git.configGet r' "annex.uuid" "", r')
+ Right r' -> return (toUUID $ Git.configGet r' "annex.uuid" "", r')
Left _ -> return (NoUUID, r)
{- Converts a bup remote path spec into a Git.Repo. There are some