diff options
author | Joey Hess <joey@kitenet.net> | 2011-06-29 11:42:00 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-06-29 11:42:00 -0400 |
commit | b3aaf980e460c2287fc1ef2b262685b1879e6ed0 (patch) | |
tree | f7f02ff6350cbf7f4470c696b5a6366c88350fa5 | |
parent | fb7663ceb86b309dd223ebc113c8b586955a0e03 (diff) |
--force will cause add, etc, to operate on ignored files.
-rw-r--r-- | Command.hs | 3 | ||||
-rw-r--r-- | Command/Add.hs | 6 | ||||
-rw-r--r-- | GitRepo.hs | 14 | ||||
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | doc/bugs/git_annex_should_use___39__git_add_-f__39___internally.mdwn | 5 | ||||
-rw-r--r-- | doc/git-annex.mdwn | 3 |
6 files changed, 23 insertions, 9 deletions
diff --git a/Command.hs b/Command.hs index 228c1f40e..ee81bd0f6 100644 --- a/Command.hs +++ b/Command.hs @@ -143,7 +143,8 @@ withFilesMissing a params = do withFilesNotInGit :: CommandSeekBackendFiles withFilesNotInGit a params = do repo <- Annex.gitRepo - newfiles <- liftIO $ runPreserveOrder (Git.notInRepo repo) params + force <- Annex.getState Annex.force + newfiles <- liftIO $ runPreserveOrder (Git.notInRepo repo force) params newfiles' <- filterFiles newfiles backendPairs a newfiles' withWords :: CommandSeekWords diff --git a/Command/Add.hs b/Command/Add.hs index 29a1518e8..5133ee1fd 100644 --- a/Command/Add.hs +++ b/Command/Add.hs @@ -11,6 +11,7 @@ import Control.Monad.State (liftIO) import System.Posix.Files import Command +import qualified Annex import qualified AnnexQueue import qualified Backend import LocationLog @@ -60,5 +61,8 @@ cleanup file key = do let mtime = modificationTime s liftIO $ touch file (TimeSpec mtime) False - AnnexQueue.add "add" [Param "--"] file + force <- Annex.getState Annex.force + if force + then AnnexQueue.add "add" [Param "-f", Param "--"] file + else AnnexQueue.add "add" [Param "--"] file return True diff --git a/GitRepo.hs b/GitRepo.hs index 9f4a38a5f..844917b88 100644 --- a/GitRepo.hs +++ b/GitRepo.hs @@ -382,13 +382,15 @@ reap = do {- Scans for files that are checked into git at the specified locations. -} inRepo :: Repo -> [FilePath] -> IO [FilePath] inRepo repo l = pipeNullSplit repo $ - [Params "ls-files --cached --exclude-standard -z --"] ++ map File l + [Params "ls-files --cached -z --"] ++ map File l -{- Scans for files at the specified locations that are not checked into git, - - and not gitignored. -} -notInRepo :: Repo -> [FilePath] -> IO [FilePath] -notInRepo repo l = pipeNullSplit repo $ - [Params "ls-files --others --exclude-standard -z --"] ++ map File l +{- Scans for files at the specified locations that are not checked into + - git. -} +notInRepo :: Repo -> Bool -> [FilePath] -> IO [FilePath] +notInRepo repo include_ignored l = + pipeNullSplit repo $ [Params "ls-files --others"]++exclude++[Params "-z --"] ++ map File l + where + exclude = if include_ignored then [] else [Param "--exclude-standard"] {- Returns a list of all files that are staged for commit. -} stagedFiles :: Repo -> [FilePath] -> IO [FilePath] diff --git a/debian/changelog b/debian/changelog index 6439eb89f..8848cf861 100644 --- a/debian/changelog +++ b/debian/changelog @@ -9,6 +9,7 @@ git-annex (0.20110611) UNRELEASED; urgency=low * unlock: Made atomic. * git-union-merge: New git subcommand, that does a generic union merge operation, and operates efficiently without touching the working tree. + * --force will cause add, etc, to operate on ignored files. -- Joey Hess <joeyh@debian.org> Mon, 13 Jun 2011 19:53:24 -0400 diff --git a/doc/bugs/git_annex_should_use___39__git_add_-f__39___internally.mdwn b/doc/bugs/git_annex_should_use___39__git_add_-f__39___internally.mdwn index 66b3aa36a..a92f5871b 100644 --- a/doc/bugs/git_annex_should_use___39__git_add_-f__39___internally.mdwn +++ b/doc/bugs/git_annex_should_use___39__git_add_-f__39___internally.mdwn @@ -3,4 +3,9 @@ I have this line in the .gitignore file of one of my repos: So the command 'git annex init name' fails to add the file ".git-annex/uuid.log", and the same problem happens when git-annex-add'ing files. +> This is avoided on the v3 branch, which does not store these files in the +> same branch as your repository. + Also, when a file is git-ignored, it should be possible to 'git annex add' it with a -f/--force option, the same way git does it. + +> Reasonable, [[done]] --[[Joey]] diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn index 12756d802..177df0952 100644 --- a/doc/git-annex.mdwn +++ b/doc/git-annex.mdwn @@ -314,7 +314,8 @@ Many git-annex commands will stage changes for later `git commit` by you. * --force Force unsafe actions, such as dropping a file's content when no other - source of it can be verified to still exist. Use with care. + source of it can be verified to still exist, or adding ignored files. + Use with care. * --fast |