summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-12 13:12:47 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-12 13:12:47 -0400
commit4fbdb197d524720d1ea77795b33cb5d24152bce9 (patch)
tree75d6223b2747ad52184d80f7694e170492d92368
parentdc1d5e68317b85043c8c30a82f53f78b0a9a9f51 (diff)
correctness
-rw-r--r--Annex.hs9
-rw-r--r--GitRepo.hs1
-rw-r--r--UUID.hs6
3 files changed, 9 insertions, 7 deletions
diff --git a/Annex.hs b/Annex.hs
index 31897479d..ed3e4e33a 100644
--- a/Annex.hs
+++ b/Annex.hs
@@ -33,11 +33,12 @@ annexDir repo key = gitDir repo ++ "/annex/" ++ key
startAnnex :: IO State
startAnnex = do
r <- gitRepoFromCwd
- gitPrep r
+ r' <- prepUUID r
+ gitPrep r'
return State {
- repo = r,
- backends = parseBackendList $ gitConfig r "annex.backends" ""
+ repo = r',
+ backends = parseBackendList $ gitConfig r' "annex.backends" ""
}
{- Annexes a file, storing it in a backend, and then moving it into
@@ -85,8 +86,6 @@ unannexFile state file = do
{- Sets up a git repo for git-annex. May be called repeatedly. -}
gitPrep :: GitRepo -> IO ()
gitPrep repo = do
- prepUUID repo
-
-- configure git to use union merge driver on state files
let attrLine = stateLoc ++ "/*.log merge=union"
let attributes = gitAttributes repo
diff --git a/GitRepo.hs b/GitRepo.hs
index b166e3281..9a919128e 100644
--- a/GitRepo.hs
+++ b/GitRepo.hs
@@ -14,6 +14,7 @@ module GitRepo (
gitDir,
gitRelative,
gitConfig,
+ gitConfigRead,
gitAdd,
gitRm,
gitRun,
diff --git a/UUID.hs b/UUID.hs
index a0e078482..0b795b8c1 100644
--- a/UUID.hs
+++ b/UUID.hs
@@ -23,14 +23,16 @@ genUUID :: IO String
genUUID = do
pOpen ReadFromPipe "uuid" ["-m"] $ \h -> hGetLine h
+{- Looks up a repo's UUID -}
getUUID :: GitRepo -> String
getUUID repo = gitConfig repo "annex.uuid" ""
{- Make sure that the repo has an annex.uuid setting. -}
-prepUUID :: GitRepo -> IO ()
+prepUUID :: GitRepo -> IO GitRepo
prepUUID repo =
if ("" == getUUID repo)
then do
uuid <- genUUID
gitRun repo ["config", configkey, uuid]
- else return ()
+ gitConfigRead repo -- return new repo with updated config
+ else return repo