allow adding unlocked files
This commit is contained in:
parent
81524d19a7
commit
e826368cec
1 changed files with 9 additions and 8 deletions
17
CmdLine.hs
17
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
|
||||
|
|
Loading…
Reference in a new issue