diff options
author | Joey Hess <joey@kitenet.net> | 2012-12-29 14:45:19 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-12-29 14:45:19 -0400 |
commit | 992eb6d6931cfc2ca8da0fe2d25e58742ce8cd77 (patch) | |
tree | cb1b35a324ee240fc2291b847e96e46944e5fbfc /Command/AddUrl.hs | |
parent | a2acf0ed7f27bf4ce37be39d1c5f47c414183ead (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/AddUrl.hs')
-rw-r--r-- | Command/AddUrl.hs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Command/AddUrl.hs b/Command/AddUrl.hs index dca515b70..9c6e8aa86 100644 --- a/Command/AddUrl.hs +++ b/Command/AddUrl.hs @@ -24,7 +24,7 @@ import Types.KeySource import Config def :: [Command] -def = [notDirect $ withOptions [fileOption, pathdepthOption] $ +def = [notDirect $ notBareRepo $ withOptions [fileOption, pathdepthOption] $ command "addurl" (paramRepeating paramUrl) seek "add urls to annex"] fileOption :: Option @@ -39,7 +39,7 @@ seek = [withField fileOption return $ \f -> withStrings $ start f d] start :: Maybe FilePath -> Maybe Int -> String -> CommandStart -start optfile pathdepth s = notBareRepo $ go $ fromMaybe bad $ parseURI s +start optfile pathdepth s = go $ fromMaybe bad $ parseURI s where bad = fromMaybe (error $ "bad url " ++ s) $ parseURI $ escapeURIString isUnescapedInURI s |