enable filter.annex.process in v9

This has tradeoffs, but is generally a win, and users who it causes git add to
slow down unacceptably for can just disable it again.

It needed to happen in an upgrade, since there are git-annex versions
that do not support it, and using such an old version with a v8
repository with filter.annex.process set will cause bad behavior.
By enabling it in v9, it's guaranteed that any git-annex version that
can use the repository does support it. Although, this is not a perfect
protection against problems, since an old git-annex version, if it's
used with a v9 repository, will cause git add to try to run
git-annex filter-process, which will fail. But at least, the user is
unlikely to have an old git-annex in path if they are using a v9
repository, since it won't work in that repository.

Sponsored-by: Dartmouth College's Datalad project
This commit is contained in:
Joey Hess 2022-01-21 13:11:18 -04:00
parent fad11c2250
commit 47084b8a1d
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
7 changed files with 31 additions and 8 deletions

View file

@ -1,6 +1,6 @@
{- Git smudge filter configuration
-
- Copyright 2011-2019 Joey Hess <id@joeyh.name>
- Copyright 2011-2022 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
@ -16,6 +16,7 @@ import qualified Git.Command
import Git.Types
import Config
import Utility.Directory.Create
import Annex.Version
import qualified System.FilePath.ByteString as P
@ -32,6 +33,8 @@ configureSmudgeFilter = unlessM (fromRepo Git.repoIsLocalBare) $ do
setConfig (ConfigKey "filter.annex.smudge") "git-annex smudge -- %f"
setConfig (ConfigKey "filter.annex.clean") "git-annex smudge --clean -- %f"
whenM (versionSupportsFilterProcess <$> getVersion)
configureSmudgeFilterProcess
lf <- Annex.fromRepo Git.attributesLocal
gf <- Annex.fromRepo Git.attributes
lfs <- readattr lf
@ -43,6 +46,10 @@ configureSmudgeFilter = unlessM (fromRepo Git.repoIsLocalBare) $ do
where
readattr = liftIO . catchDefaultIO "" . readFileStrict . fromRawFilePath
configureSmudgeFilterProcess :: Annex ()
configureSmudgeFilterProcess =
setConfig (ConfigKey "filter.annex.process") "git-annex filter-process"
stdattr :: [String]
stdattr =
[ "* filter=annex"