From 5f7979ffe85e036451bb869e29ca161ad3aa0272 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 15 Mar 2015 13:51:58 -0400 Subject: fromkey --force: Skip test that the key has its content in the annex. --- Command/FromKey.hs | 18 +++++++++++------- debian/changelog | 1 + doc/git-annex.mdwn | 3 +++ 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Command/FromKey.hs b/Command/FromKey.hs index d9ebe6b4c..7176d97a5 100644 --- a/Command/FromKey.hs +++ b/Command/FromKey.hs @@ -12,6 +12,7 @@ import Command import qualified Annex.Queue import Annex.Content import Types.Key +import qualified Annex cmd :: [Command] cmd = [notDirect $ notBareRepo $ @@ -19,17 +20,20 @@ cmd = [notDirect $ notBareRepo $ SectionPlumbing "adds a file using a specific key"] seek :: CommandSeek -seek = withWords start +seek ps = do + force <- Annex.getState Annex.force + withWords (start force) ps -start :: [String] -> CommandStart -start (keyname:file:[]) = do +start :: Bool -> [String] -> CommandStart +start force (keyname:file:[]) = do let key = fromMaybe (error "bad key") $ file2key keyname - inbackend <- inAnnex key - unless inbackend $ error $ - "key ("++ keyname ++") is not present in backend" + unless force $ do + inbackend <- inAnnex key + unless inbackend $ error $ + "key ("++ keyname ++") is not present in backend (use --force to override this sanity check)" showStart "fromkey" file next $ perform key file -start _ = error "specify a key and a dest file" +start _ _ = error "specify a key and a dest file" perform :: Key -> FilePath -> CommandPerform perform key file = do diff --git a/debian/changelog b/debian/changelog index 5c501c2f3..d238a32bf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -35,6 +35,7 @@ git-annex (5.2015022) UNRELEASED; urgency=medium bittorrent etc urls. * git-annex-shell: Improve error message when the specified repository doesn't exist or git config fails for some reason. + * fromkey --force: Skip test that the key has its content in the annex. -- Joey Hess Thu, 19 Feb 2015 14:16:03 -0400 diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn index de4a580ed..254e0883b 100644 --- a/doc/git-annex.mdwn +++ b/doc/git-annex.mdwn @@ -957,6 +957,9 @@ subdirectories). This plumbing-level command can be used to manually set up a file in the git repository to link to a specified key. + Normally, the annex needs to already contain the content object for the + key. To override this, use --force. + * `dropkey [key ...]` This plumbing-level command drops the annexed data for the specified -- cgit v1.2.3