summaryrefslogtreecommitdiff
path: root/Core.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-23 13:18:47 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-23 13:18:47 -0400
commit9dfbf40d1a8493ec191f8e79410ed9d2a9508141 (patch)
treef740095602d3f7733bdc3cccf598f699fdc2815f /Core.hs
parent5a91543be33719d6da7b53c4c449be8f75481375 (diff)
reorg remote key presense checking code
Also, it now checks if a key is inAnnex, ie, cached in .git/annex, not if it is present in a remote. For the File Backend, these are equivilant, not so for other backends.
Diffstat (limited to 'Core.hs')
-rw-r--r--Core.hs12
1 files changed, 10 insertions, 2 deletions
diff --git a/Core.hs b/Core.hs
index 4941dc26b..da05823bb 100644
--- a/Core.hs
+++ b/Core.hs
@@ -62,11 +62,19 @@ gitAttributes repo = do
Git.run repo ["commit", "-m", "git-annex setup",
attributes]
-{- Checks if a given key is currently present in the annexLocation -}
+{- Checks if a given key is currently present in the annexLocation.
+ -
+ - This can be run against a remote repository to check the key there. -}
inAnnex :: Key -> Annex Bool
inAnnex key = do
g <- Annex.gitRepo
- liftIO $ doesFileExist $ annexLocation g key
+ if (not $ Git.repoIsUrl g)
+ then liftIO $ doesFileExist $ annexLocation g key
+ else do
+ showNote ("checking " ++ Git.repoDescribe g ++ "...")
+ liftIO $ boolSystem "ssh" [Git.urlHost g,
+ "test -e " ++
+ (shellEscape $ annexLocation g key)]
{- Calculates the relative path to use to link a file to a key. -}
calcGitLink :: FilePath -> Key -> Annex FilePath