summaryrefslogtreecommitdiff
path: root/Locations.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-10-03 16:32:36 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-10-03 16:32:36 -0400
commitd357556141b716a8c9d622cbfb44c38484065183 (patch)
treec680690d0920cf6533bea0d700a2298b60ad66da /Locations.hs
parentf77979b8b5ef1dc59b45c03ba6febfacdf904491 (diff)
Add locking to avoid races when changing the git-annex branch.
Diffstat (limited to 'Locations.hs')
-rw-r--r--Locations.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/Locations.hs b/Locations.hs
index 942b687bb..b18444e72 100644
--- a/Locations.hs
+++ b/Locations.hs
@@ -18,6 +18,7 @@ module Locations (
gitAnnexBadLocation,
gitAnnexUnusedLog,
gitAnnexJournalDir,
+ gitAnnexJournalLock,
isLinkToAnnex,
hashDirMixed,
hashDirLower,
@@ -109,6 +110,10 @@ gitAnnexUnusedLog prefix r = gitAnnexDir r </> (prefix ++ "unused")
gitAnnexJournalDir :: Git.Repo -> FilePath
gitAnnexJournalDir r = addTrailingPathSeparator $ gitAnnexDir r </> "journal"
+{- Lock file for the journal. -}
+gitAnnexJournalLock :: Git.Repo -> FilePath
+gitAnnexJournalLock r = gitAnnexDir r </> "journal.lck"
+
{- Checks a symlink target to see if it appears to point to annexed content. -}
isLinkToAnnex :: FilePath -> Bool
isLinkToAnnex s = ("/.git/" ++ objectDir) `isInfixOf` s