aboutsummaryrefslogtreecommitdiff
path: root/Command/Add.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/Add.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/Add.hs')
-rw-r--r--Command/Add.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/Command/Add.hs b/Command/Add.hs
index 9f203346f..b3181cfd7 100644
--- a/Command/Add.hs
+++ b/Command/Add.hs
@@ -23,7 +23,8 @@ import Utility.FileMode
import Config
def :: [Command]
-def = [notDirect $ command "add" paramPaths seek "add files to annex"]
+def = [notDirect $ notBareRepo $
+ command "add" paramPaths seek "add files to annex"]
{- Add acts on both files not checked into git yet, and unlocked files. -}
seek :: [CommandSeek]
@@ -33,7 +34,7 @@ seek = [withFilesNotInGit start, withFilesUnlocked start]
- backend, and then moving it into the annex directory and setting up
- the symlink pointing to its content. -}
start :: FilePath -> CommandStart
-start file = notBareRepo $ ifAnnexed file fixup add
+start file = ifAnnexed file fixup add
where
add = do
s <- liftIO $ getSymbolicLinkStatus file