summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-11-19 15:40:40 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-11-19 15:40:40 -0400
commit0fa1d136dc74828eab820d7c74c811d707cc746a (patch)
treed9435574440b0cce380424c100fa44919ca673b5
parent32d9813b1dc50a3300f24f3ddbf534c6cc529d6e (diff)
tweak
-rw-r--r--Annex/UUID.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/Annex/UUID.hs b/Annex/UUID.hs
index 6fc04c0f0..3b64bf3d8 100644
--- a/Annex/UUID.hs
+++ b/Annex/UUID.hs
@@ -39,10 +39,11 @@ genUUID = pOpen ReadFromPipe command params $ liftM toUUID . hGetLine
-- uuidgen generates random uuid by default
else []
+{- Get current repository's UUID. -}
getUUID :: Annex UUID
getUUID = getRepoUUID =<< gitRepo
-{- Looks up a repo's UUID. May return "" if none is known. -}
+{- Looks up a repo's UUID, caching it in .git/config if it's not already. -}
getRepoUUID :: Git.Repo -> Annex UUID
getRepoUUID r = do
c <- fromRepo cached
@@ -54,7 +55,7 @@ getRepoUUID r = do
return u
else return c
where
- cached g = toUUID $ Git.configGet cachekey "" g
+ cached = toUUID . Git.configGet cachekey ""
updatecache u = do
g <- gitRepo
when (g /= r) $ storeUUID cachekey u