init: Configure .git/info/attributes to use git-annex as a smudge filter.
Note that this changes the default behavior of git add in a newly initialized repository; it will add files to the annex. Don't like that this could break workflows, but it's necessary in order for any pointer files in the repo to be handled by git-annex.
This commit is contained in:
parent
fb6ebdaae7
commit
2fe21d47c5
6 changed files with 60 additions and 21 deletions
13
Config.hs
13
Config.hs
|
@ -95,3 +95,16 @@ configureSmudgeFilter :: Annex ()
|
|||
configureSmudgeFilter = do
|
||||
setConfig (ConfigKey "filter.annex.smudge") "git-annex smudge %f"
|
||||
setConfig (ConfigKey "filter.annex.clean") "git-annex smudge --clean %f"
|
||||
lf <- Annex.fromRepo Git.attributesLocal
|
||||
gf <- Annex.fromRepo Git.attributes
|
||||
lfs <- readattr lf
|
||||
gfs <- readattr gf
|
||||
liftIO $ unless ("filter=annex" `isInfixOf` (lfs ++ gfs)) $ do
|
||||
createDirectoryIfMissing True (takeDirectory lf)
|
||||
writeFile lf (lfs ++ "\n" ++ stdattr)
|
||||
where
|
||||
readattr = liftIO . catchDefaultIO "" . readFileStrictAnyEncoding
|
||||
stdattr = unlines
|
||||
[ "* filter=annex"
|
||||
, ".* !filter"
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue