summaryrefslogtreecommitdiff
path: root/Config/Smudge.hs
diff options
context:
space:
mode:
authorJoeyHess <>2019-10-09 16:34:00 (GMT)
committerhdiff <hdiff@hdiff.luite.com>2019-10-09 16:34:00 (GMT)
commit66f771a916b67bd08f4070487e79e4a4359fd852 (patch)
tree6e09eba777f8bcebac4f30093c63f3ffd029e741 /Config/Smudge.hs
parent09e89c7ef80c7e879bfe1376102101cca6baf130 (diff)
version 7.201910097.20191009
Diffstat (limited to 'Config/Smudge.hs')
-rw-r--r--Config/Smudge.hs27
1 files changed, 21 insertions, 6 deletions
diff --git a/Config/Smudge.hs b/Config/Smudge.hs
index f1d7bc4..b81db28 100644
--- a/Config/Smudge.hs
+++ b/Config/Smudge.hs
@@ -1,6 +1,6 @@
{- Git smudge filter configuration
-
- - Copyright 2011-2018 Joey Hess <id@joeyh.name>
+ - Copyright 2011-2019 Joey Hess <id@joeyh.name>
-
- Licensed under the GNU AGPL version 3 or higher.
-}
@@ -32,10 +32,25 @@ configureSmudgeFilter = unlessM (fromRepo Git.repoIsLocalBare) $ do
gfs <- readattr gf
liftIO $ unless ("filter=annex" `isInfixOf` (lfs ++ gfs)) $ do
createDirectoryIfMissing True (takeDirectory lf)
- writeFile lf (lfs ++ "\n" ++ stdattr)
+ writeFile lf (lfs ++ "\n" ++ unlines stdattr)
where
readattr = liftIO . catchDefaultIO "" . readFileStrict
- stdattr = unlines
- [ "* filter=annex"
- , ".* !filter"
- ]
+
+stdattr :: [String]
+stdattr =
+ [ "* filter=annex"
+ , ".* !filter"
+ ]
+
+-- Note that this removes the local git attributes for filtering,
+-- which is what git-annex installed, but it does not change anything
+-- that may have been committed to a .gitattributes in the repository.
+-- git-annex does not commit that.
+deconfigureSmudgeFilter :: Annex ()
+deconfigureSmudgeFilter = do
+ lf <- Annex.fromRepo Git.attributesLocal
+ ls <- liftIO $ catchDefaultIO [] $ lines <$> readFileStrict lf
+ liftIO $ writeFile lf $ unlines $
+ filter (\l -> l `notElem` stdattr && not (null l)) ls
+ unsetConfig (ConfigKey "filter.annex.smudge")
+ unsetConfig (ConfigKey "filter.annex.clean")