This fixes a bug in the assistant introduced by the literal pathspec changes in version 5.20150406.

git-checkignore refuses to work if any pathspec options are set. Urgh.

I audited the rest of git, and no other commands used by git-annex have
such limitations. Indeed, AFAICS, *all* other commands support
--literal-pathspecs. So, worked around this where git-checkignore is
called.
This commit is contained in:
Joey Hess 2015-04-09 13:35:02 -04:00
parent 3695094454
commit 0f740fd198
3 changed files with 25 additions and 1 deletions

View file

@ -31,10 +31,13 @@ type CheckIgnoreHandle = CoProcess.CoProcessHandle
-
- The first version of git to support what we need is 1.8.4.
- Nothing is returned if an older git is installed.
-
- check-ignore does not support --literal-pathspecs, so remove that
- from the gitGlobalOpts if set.
-}
checkIgnoreStart :: Repo -> IO (Maybe CheckIgnoreHandle)
checkIgnoreStart repo = ifM supportedGitVersion
( Just <$> (CoProcess.rawMode =<< gitCoProcessStart True params repo)
( Just <$> (CoProcess.rawMode =<< gitCoProcessStart True params repo')
, return Nothing
)
where
@ -42,6 +45,9 @@ checkIgnoreStart repo = ifM supportedGitVersion
[ Param "check-ignore"
, Params "-z --stdin --verbose --non-matching"
]
repo' = repo { gitGlobalOpts = filter (not . pathspecs) (gitGlobalOpts repo) }
pathspecs (Param "--literal-pathspecs") = True
pathspecs _ = False
supportedGitVersion :: IO Bool
supportedGitVersion = do