summaryrefslogtreecommitdiff
path: root/CmdLine.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-11-10 14:02:08 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-11-10 14:02:08 -0400
commite826368cecb2e515cc3c4f5f8d0385c025b069a6 (patch)
tree199aa25680f1ff99462ad7305ed7e8e0a14ae508 /CmdLine.hs
parent81524d19a7e5bc5f7b573260babe2def279187f7 (diff)
allow adding unlocked files
Diffstat (limited to 'CmdLine.hs')
-rw-r--r--CmdLine.hs17
1 files changed, 9 insertions, 8 deletions
diff --git a/CmdLine.hs b/CmdLine.hs
index 3f2b1e94e..7e6626573 100644
--- a/CmdLine.hs
+++ b/CmdLine.hs
@@ -36,7 +36,7 @@ import qualified Command.PreCommit
subCmds :: [SubCommand]
subCmds =
- [ SubCommand "add" path (withFilesNotInGit Command.Add.start)
+ [ SubCommand "add" path (withFilesToAdd Command.Add.start)
"add files to annex"
, SubCommand "get" path (withFilesInGit Command.Get.start)
"make content of annexed files available"
@@ -115,13 +115,6 @@ usage = usageInfo header options ++ "\nSubcommands:\n" ++ cmddescs
{- These functions find appropriate files or other things based on a
user's parameters. -}
-withFilesNotInGit :: SubCmdSeekBackendFiles
-withFilesNotInGit a params = do
- repo <- Annex.gitRepo
- files <- liftIO $ mapM (Git.notInRepo repo) params
- let files' = foldl (++) [] files
- pairs <- Backend.chooseBackends files'
- return $ map a $ filter (\(f,_) -> notState f) pairs
withFilesInGit :: SubCmdSeekStrings
withFilesInGit a params = do
repo <- Annex.gitRepo
@@ -135,6 +128,14 @@ withFilesMissing a params = do
missing f = do
e <- doesFileExist f
return $ not e
+withFilesToAdd :: SubCmdSeekBackendFiles
+withFilesToAdd a params = do
+ repo <- Annex.gitRepo
+ newfiles <- liftIO $ mapM (Git.notInRepo repo) params
+ unlockedfiles <- liftIO $ mapM (Git.typeChangedFiles repo) params
+ let files = foldl (++) [] $ newfiles ++ unlockedfiles
+ pairs <- Backend.chooseBackends files
+ return $ map a $ filter (\(f,_) -> notState f) pairs
withDescription :: SubCmdSeekStrings
withDescription a params = return [a $ unwords params]
withFilesToBeCommitted :: SubCmdSeekStrings