summaryrefslogtreecommitdiff
path: root/Annex/UUID.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-04-15 20:13:35 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-04-15 20:13:35 -0400
commitdc748c7336aea9cbf04c0311098a44c2b329633d (patch)
tree1a993dd9662ff046b74a427232b8e301500a97b8 /Annex/UUID.hs
parent60c4bcefd4d3001e7025fc59c1f7ab927a3a5c34 (diff)
reinit: New command that can initialize a new reposotory using the configuration of a previously known repository. Useful if a repository got deleted and you want to clone it back the way it was.
Diffstat (limited to 'Annex/UUID.hs')
-rw-r--r--Annex/UUID.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/Annex/UUID.hs b/Annex/UUID.hs
index 4e274503b..5ed887689 100644
--- a/Annex/UUID.hs
+++ b/Annex/UUID.hs
@@ -21,6 +21,7 @@ module Annex.UUID (
gCryptNameSpace,
removeRepoUUID,
storeUUID,
+ storeUUIDIn,
setUUID,
) where
@@ -70,7 +71,7 @@ getRepoUUID r = do
where
updatecache u = do
g <- gitRepo
- when (g /= r) $ storeUUID cachekey u
+ when (g /= r) $ storeUUIDIn cachekey u
cachekey = remoteConfig r "uuid"
removeRepoUUID :: Annex ()
@@ -84,10 +85,13 @@ getUncachedUUID = toUUID . Git.Config.get key ""
{- Make sure that the repo has an annex.uuid setting. -}
prepUUID :: Annex ()
prepUUID = whenM ((==) NoUUID <$> getUUID) $
- storeUUID configkey =<< liftIO genUUID
+ storeUUID =<< liftIO genUUID
-storeUUID :: ConfigKey -> UUID -> Annex ()
-storeUUID configfield = setConfig configfield . fromUUID
+storeUUID :: UUID -> Annex ()
+storeUUID = storeUUIDIn configkey
+
+storeUUIDIn :: ConfigKey -> UUID -> Annex ()
+storeUUIDIn configfield = setConfig configfield . fromUUID
{- Only sets the configkey in the Repo; does not change .git/config -}
setUUID :: Git.Repo -> UUID -> IO Git.Repo