add remote start and stop hooks

Locking is used, so that, if there are multiple git-annex processes
using a remote concurrently, the stop hook is only run by the last
process that uses it.
This commit is contained in:
Joey Hess 2012-03-04 16:00:24 -04:00
parent fba66c55ed
commit 52e88f3ebf
5 changed files with 118 additions and 1 deletions

View file

@ -24,6 +24,7 @@ module Locations (
gitAnnexIndexLock,
gitAnnexIndexDirty,
gitAnnexSshDir,
gitAnnexRemotesDir,
isLinkToAnnex,
annexHashes,
hashDirMixed,
@ -152,6 +153,10 @@ gitAnnexIndexDirty r = gitAnnexDir r </> "index.dirty"
gitAnnexSshDir :: Git.Repo -> FilePath
gitAnnexSshDir r = addTrailingPathSeparator $ gitAnnexDir r </> "ssh"
{- .git/annex/remotes/ is used for remote-specific state. -}
gitAnnexRemotesDir :: Git.Repo -> FilePath
gitAnnexRemotesDir r = addTrailingPathSeparator $ gitAnnexDir r </> "remotes"
{- Checks a symlink target to see if it appears to point to annexed content. -}
isLinkToAnnex :: FilePath -> Bool
isLinkToAnnex s = ("/.git/" ++ objectDir) `isInfixOf` s