summaryrefslogtreecommitdiff
path: root/Command/FromKey.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-12-29 14:45:19 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-12-29 14:45:19 -0400
commit992eb6d6931cfc2ca8da0fe2d25e58742ce8cd77 (patch)
treecb1b35a324ee240fc2291b847e96e46944e5fbfc /Command/FromKey.hs
parenta2acf0ed7f27bf4ce37be39d1c5f47c414183ead (diff)
convert notBareRepo to a CommandCheck
This avoids some small overhead by only running the check once per command; it also ensures that, even if the command doesn't find anything to run on, it still fails to run when in a bare repo.
Diffstat (limited to 'Command/FromKey.hs')
-rw-r--r--Command/FromKey.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/Command/FromKey.hs b/Command/FromKey.hs
index a2ab55c9c..d023be686 100644
--- a/Command/FromKey.hs
+++ b/Command/FromKey.hs
@@ -14,14 +14,15 @@ import Annex.Content
import Types.Key
def :: [Command]
-def = [notDirect $ command "fromkey" (paramPair paramKey paramPath) seek
- "adds a file using a specific key"]
+def = [notDirect $ notBareRepo $
+ command "fromkey" (paramPair paramKey paramPath) seek
+ "adds a file using a specific key"]
seek :: [CommandSeek]
seek = [withWords start]
start :: [String] -> CommandStart
-start (keyname:file:[]) = notBareRepo $ do
+start (keyname:file:[]) = do
let key = fromMaybe (error "bad key") $ file2key keyname
inbackend <- inAnnex key
unless inbackend $ error $