diff options
author | Joey Hess <joey@kitenet.net> | 2010-10-17 10:47:46 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-10-17 10:47:46 -0400 |
commit | 6bfa534aa4d7552c4ccfdb9523b55da19fac8883 (patch) | |
tree | 7d9f9789ddb99bc04289c276f098b1803d752f99 | |
parent | a0b040524a595c16ddb2dbead205ca8ccb6890aa (diff) |
git annex drop -- do not try to drop if key is not in backend
-rw-r--r-- | Commands.hs | 23 | ||||
-rw-r--r-- | TODO | 6 |
2 files changed, 19 insertions, 10 deletions
diff --git a/Commands.hs b/Commands.hs index 5931bf0a9..b446dbfac 100644 --- a/Commands.hs +++ b/Commands.hs @@ -165,13 +165,20 @@ getCmd file = notinBackend file err $ \(key, backend) -> do - if it's safe to do so. -} dropCmd :: FilePath -> Annex () dropCmd file = notinBackend file err $ \(key, backend) -> do - force <- Annex.flagIsSet Force - if (not force) - then requireEnoughCopies key - else return () - success <- Backend.removeKey backend key - if (success) - then do + inbackend <- Backend.hasKey key + if (not inbackend) + then return () -- no-op + else do + force <- Annex.flagIsSet Force + if (not force) + then requireEnoughCopies key + else return () + success <- Backend.removeKey backend key + if (success) + then cleanup key + else error $ "backend refused to drop " ++ file + where + cleanup key = do logStatus key ValueMissing inannex <- inAnnex key if (inannex) @@ -181,8 +188,6 @@ dropCmd file = notinBackend file err $ \(key, backend) -> do liftIO $ removeFile loc return () else return () - else error $ "backend refused to drop " ++ file - where err = error $ "not annexed " ++ file {- Fixes the symlink to an annexed file. -} @@ -1,7 +1,11 @@ * bug: cannot "git annex ../foo" (GitRepo.relative is buggy and git-ls-files also refuses w/o --full-name, which would need other changes) -* --push/--pull/--want +* bug: git annex add file is silent if file was a symlink and got replaced + with a file. The you then git command -a, you'll check in the fil contents.. + +* --push/--pull should take a reponame and files, and push those files + to that repo; dropping them from the current repo * how to handle git mv file? -> git annex fix -> run automatically? |