diff options
author | Joey Hess <joey@kitenet.net> | 2011-10-03 15:41:25 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-10-03 15:41:25 -0400 |
commit | f77979b8b5ef1dc59b45c03ba6febfacdf904491 (patch) | |
tree | 952982098f70079e67347fce3e2fd99e515a708e /RemoteLog.hs | |
parent | 6dfb94b2d783ef848c651ab20818b05c8a0504a6 (diff) |
improved git-annex branch changing
All changes to files in the branch are now made via pure functions that
transform the old file into the new. This will allow adding locking
to prevent read/write races. It also makes the code nicer, and purer.
I noticed a behavior change, really a sort of bug fix. Before,
'git annex untrust foo --trust bar' would change both trust levels
permanantly, now the --trust doesn't get stored.
Diffstat (limited to 'RemoteLog.hs')
-rw-r--r-- | RemoteLog.hs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/RemoteLog.hs b/RemoteLog.hs index 620c0d875..f9c7997e4 100644 --- a/RemoteLog.hs +++ b/RemoteLog.hs @@ -32,11 +32,10 @@ remoteLog = "remote.log" {- Adds or updates a remote's config in the log. -} configSet :: UUID -> RemoteConfig -> Annex () -configSet u c = do - m <- readRemoteLog - Branch.change remoteLog $ unlines $ sort $ - map toline $ M.toList $ M.insert u c m +configSet u c = Branch.change remoteLog $ + serialize . M.insert u c . remoteLogParse where + serialize = unlines . sort . map toline . M.toList toline (u', c') = u' ++ " " ++ unwords (configToKeyVal c') {- Map of remotes by uuid containing key/value config maps. -} |