aboutsummaryrefslogtreecommitdiff
path: root/Remote/Git.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Remote/Git.hs')
-rw-r--r--Remote/Git.hs16
1 files changed, 16 insertions, 0 deletions
diff --git a/Remote/Git.hs b/Remote/Git.hs
index 4cdedd064..be63de804 100644
--- a/Remote/Git.hs
+++ b/Remote/Git.hs
@@ -42,10 +42,12 @@ import Utility.Metered
#ifndef mingw32_HOST_OS
import Utility.CopyFile
#endif
+import Utility.Batch
import Remote.Helper.Git
import Remote.Helper.Messages
import qualified Remote.Helper.Ssh as Ssh
import qualified Remote.GCrypt
+import Config.Files
import Control.Concurrent
import Control.Concurrent.MSampleVar
@@ -111,6 +113,9 @@ gen r u c gc
, hasKey = inAnnex r
, hasKeyCheap = repoCheap r
, whereisKey = Nothing
+ , remoteFsck = if Git.repoIsUrl r
+ then Nothing
+ else Just $ fsckOnRemote r
, config = M.empty
, localpath = localpathCalc r
, repo = r
@@ -396,6 +401,17 @@ copyToRemote r key file p
(\d -> rsyncOrCopyFile params object d p)
)
+fsckOnRemote :: Git.Repo -> [CommandParam] -> Annex (IO Bool)
+fsckOnRemote r params
+ | Git.repoIsUrl r = return $ do
+ program <- readProgramFile
+ batchCommand program $ Param "fsck" : params
+ | otherwise = do
+ s <- Ssh.git_annex_shell r "fsck" params []
+ return $ case s of
+ Nothing -> return False
+ Just (c, ps) -> batchCommand c ps
+
{- Runs an action on a local repository inexpensively, by making an annex
- monad using that repository. -}
onLocal :: Git.Repo -> Annex a -> IO a