summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Command.hs3
-rw-r--r--Command/Add.hs6
-rw-r--r--GitRepo.hs14
-rw-r--r--debian/changelog1
-rw-r--r--doc/bugs/git_annex_should_use___39__git_add_-f__39___internally.mdwn11
-rw-r--r--doc/git-annex.mdwn3
6 files changed, 29 insertions, 9 deletions
diff --git a/Command.hs b/Command.hs
index 129233d74..a8cc6a132 100644
--- a/Command.hs
+++ b/Command.hs
@@ -142,7 +142,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 4a6c4d763..cfe949d5e 100644
--- a/GitRepo.hs
+++ b/GitRepo.hs
@@ -435,13 +435,15 @@ shaSize = 40
{- 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 688a4adb8..5dff0bbe5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ git-annex (3.20110625) UNRELEASED; urgency=low
* Always ensure git-annex branch exists.
* Modify location log parser to allow future expansion.
+ * --force will cause add, etc, to operate on ignored files.
-- Joey Hess <joeyh@debian.org> Sun, 26 Jun 2011 21:01:06 -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
new file mode 100644
index 000000000..a92f5871b
--- /dev/null
+++ b/doc/bugs/git_annex_should_use___39__git_add_-f__39___internally.mdwn
@@ -0,0 +1,11 @@
+I have this line in the .gitignore file of one of my repos:
+*log
+
+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 4f02db12f..a5ddf3172 100644
--- a/doc/git-annex.mdwn
+++ b/doc/git-annex.mdwn
@@ -319,7 +319,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