summaryrefslogtreecommitdiff
path: root/Remote
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-01-28 15:54:42 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-01-28 16:00:20 -0400
commit775958b4dc9edba64ab78ed90ef3c2d11f252676 (patch)
treef9beeb21861eed4ab3619d12ff8fae589c6f8d51 /Remote
parentb81d662cbf0036d0e2b632ed95a877feab2a4860 (diff)
faster local-local dropping
Dropping a key from a local remote ran git-annex-shell unnecessarily. Now git-annex-shell is never used when acting on a local remote.
Diffstat (limited to 'Remote')
-rw-r--r--Remote/Git.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/Remote/Git.hs b/Remote/Git.hs
index 501a617c0..829ad1ccb 100644
--- a/Remote/Git.hs
+++ b/Remote/Git.hs
@@ -20,6 +20,7 @@ import qualified Git.Command
import qualified Git.Config
import qualified Git.Construct
import qualified Annex
+import Logs.Presence
import Annex.UUID
import qualified Annex.Content
import qualified Annex.BranchState
@@ -192,6 +193,14 @@ keyUrls r key = map tourl (annexLocations key)
dropKey :: Git.Repo -> Key -> Annex Bool
dropKey r key
+ | not $ Git.repoIsUrl r = liftIO $ onLocal r $ do
+ ensureInitialized
+ whenM (Annex.Content.inAnnex key) $ do
+ Annex.Content.lockContent key $
+ Annex.Content.removeAnnex key
+ Annex.Content.logStatus key InfoMissing
+ Annex.Content.saveState True
+ return True
| Git.repoIsHttp r = error "dropping from http repo not supported"
| otherwise = onRemote r (boolSystem, False) "dropkey"
[ Params "--quiet --force"