git annex drop -- do not try to drop if key is not in backend
This commit is contained in:
parent
a0b040524a
commit
6bfa534aa4
2 changed files with 19 additions and 10 deletions
23
Commands.hs
23
Commands.hs
|
@ -165,13 +165,20 @@ getCmd file = notinBackend file err $ \(key, backend) -> do
|
||||||
- if it's safe to do so. -}
|
- if it's safe to do so. -}
|
||||||
dropCmd :: FilePath -> Annex ()
|
dropCmd :: FilePath -> Annex ()
|
||||||
dropCmd file = notinBackend file err $ \(key, backend) -> do
|
dropCmd file = notinBackend file err $ \(key, backend) -> do
|
||||||
force <- Annex.flagIsSet Force
|
inbackend <- Backend.hasKey key
|
||||||
if (not force)
|
if (not inbackend)
|
||||||
then requireEnoughCopies key
|
then return () -- no-op
|
||||||
else return ()
|
else do
|
||||||
success <- Backend.removeKey backend key
|
force <- Annex.flagIsSet Force
|
||||||
if (success)
|
if (not force)
|
||||||
then do
|
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
|
logStatus key ValueMissing
|
||||||
inannex <- inAnnex key
|
inannex <- inAnnex key
|
||||||
if (inannex)
|
if (inannex)
|
||||||
|
@ -181,8 +188,6 @@ dropCmd file = notinBackend file err $ \(key, backend) -> do
|
||||||
liftIO $ removeFile loc
|
liftIO $ removeFile loc
|
||||||
return ()
|
return ()
|
||||||
else return ()
|
else return ()
|
||||||
else error $ "backend refused to drop " ++ file
|
|
||||||
where
|
|
||||||
err = error $ "not annexed " ++ file
|
err = error $ "not annexed " ++ file
|
||||||
|
|
||||||
{- Fixes the symlink to an annexed file. -}
|
{- Fixes the symlink to an annexed file. -}
|
||||||
|
|
6
TODO
6
TODO
|
@ -1,7 +1,11 @@
|
||||||
* bug: cannot "git annex ../foo" (GitRepo.relative is buggy and
|
* bug: cannot "git annex ../foo" (GitRepo.relative is buggy and
|
||||||
git-ls-files also refuses w/o --full-name, which would need other changes)
|
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?
|
* how to handle git mv file? -> git annex fix -> run automatically?
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue