make git-annex add --no-check-gitignore not skip ignored files, same as with --force
authorJoey Hess <joeyh@joeyh.name>
Fri, 18 Sep 2020 17:33:35 +0000 (13:33 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 18 Sep 2020 17:33:35 +0000 (13:33 -0400)
CmdLine/Seek.hs
Command/Add.hs
Command/Uninit.hs

index 89a13a96a0f3945b88030a67fe9c7609765b375c..42ab541a96a27b043db5e90ef585cb70b44694b1 100644 (file)
@@ -39,6 +39,7 @@ import Annex.Content
 import Annex.Link
 import Annex.InodeSentinal
 import Annex.Concurrent
+import Annex.CheckIgnore
 import qualified Annex.Branch
 import qualified Annex.BranchState
 import qualified Database.Keys
@@ -81,11 +82,12 @@ withFilesInGitAnnexNonRecursive ww needforce a (WorkTreeItems l) = ifM (Annex.ge
                        _ -> giveup needforce
 withFilesInGitAnnexNonRecursive _ _ _ NoWorkTreeItems = noop
 
-withFilesNotInGit :: WarnUnmatchWhen -> ((SeekInput, RawFilePath) -> CommandSeek) -> WorkTreeItems -> CommandSeek
-withFilesNotInGit ww a l = do
+withFilesNotInGit :: CheckGitIgnore -> WarnUnmatchWhen -> ((SeekInput, RawFilePath) -> CommandSeek) -> WorkTreeItems -> CommandSeek
+withFilesNotInGit (CheckGitIgnore ci) ww a l = do
        force <- Annex.getState Annex.force
+       let include_ignored = force || not ci
        seekFiltered a $
-               seekHelper id ww (const $ LsFiles.notInRepo [] force) l
+               seekHelper id ww (const $ LsFiles.notInRepo [] include_ignored) l
 
 withPathContents :: ((FilePath, FilePath) -> CommandSeek) -> CmdParams -> CommandSeek
 withPathContents a params = do
index d222e4e678afb63a30029dc74e903fddb08da87a..e42b71e0ebb298e00938949b8ef74fce113809c3 100644 (file)
@@ -98,7 +98,7 @@ seek o = startConcurrency commandStages $ do
                        l <- workTreeItems ww (addThese o)
                        let go a = a ww (commandAction . gofile) l
                        unless (updateOnly o) $
-                               go withFilesNotInGit
+                               go (withFilesNotInGit (checkGitIgnoreOption o))
                        go withFilesMaybeModified
                        go withUnmodifiedUnlockedPointers
 
index 5464849197cd15be6922367b08253737cc921a91..de05febbaf2c034d4d337345d683fa7533932483 100644 (file)
@@ -16,6 +16,7 @@ import qualified Annex.Branch
 import qualified Database.Keys
 import Annex.Content
 import Annex.Init
+import Annex.CheckIgnore
 import Utility.FileMode
 import qualified Utility.RawFilePath as R
 
@@ -42,7 +43,11 @@ check = do
 seek :: CmdParams -> CommandSeek
 seek ps = do
        l <- workTreeItems ww ps
-       withFilesNotInGit WarnUnmatchWorkTreeItems (\(_, f) -> commandAction $ whenAnnexed (startCheckIncomplete . fromRawFilePath) f) l
+       withFilesNotInGit
+               (CheckGitIgnore False)
+               WarnUnmatchWorkTreeItems 
+               (\(_, f) -> commandAction $ whenAnnexed (startCheckIncomplete . fromRawFilePath) f)
+               l
        Annex.changeState $ \s -> s { Annex.fast = True }
        withFilesInGitAnnex ww Command.Unannex.seeker l
        finish