update uninit to handle all the v7 stuff
* uninit: Remove several git hooks that git-annex init sets up. * uninit: Remove the smudge and clean filters that git-annex init sets up.
This commit is contained in:
parent
3de6dffd36
commit
53da7f1cf8
5 changed files with 41 additions and 12 deletions
|
@ -1,10 +1,10 @@
|
|||
{- git-annex git hooks
|
||||
-
|
||||
- Note that it's important that the scripts installed by git-annex
|
||||
- not change, otherwise removing old hooks using an old version of
|
||||
- the script would fail.
|
||||
- Note that it's important that the content of scripts installed by
|
||||
- git-annex not change, otherwise removing old hooks using an old
|
||||
- version of the script would fail.
|
||||
-
|
||||
- Copyright 2013-2018 Joey Hess <id@joeyh.name>
|
||||
- Copyright 2013-2019 Joey Hess <id@joeyh.name>
|
||||
-
|
||||
- Licensed under the GNU AGPL version 3 or higher.
|
||||
-}
|
||||
|
@ -18,6 +18,16 @@ import Utility.Shell
|
|||
|
||||
import qualified Data.Map as M
|
||||
|
||||
-- Remove all hooks.
|
||||
unHook :: Annex ()
|
||||
unHook = do
|
||||
hookUnWrite preCommitHook
|
||||
hookUnWrite postReceiveHook
|
||||
hookUnWrite postCheckoutHook
|
||||
hookUnWrite postMergeHook
|
||||
hookUnWrite preCommitAnnexHook
|
||||
hookUnWrite postUpdateAnnexHook
|
||||
|
||||
preCommitHook :: Git.Hook
|
||||
preCommitHook = Git.Hook "pre-commit" (mkHookScript "git annex pre-commit .") []
|
||||
|
||||
|
|
|
@ -128,8 +128,8 @@ initialize' mversion = checkCanInitialize $ do
|
|||
|
||||
uninitialize :: Annex ()
|
||||
uninitialize = do
|
||||
hookUnWrite preCommitHook
|
||||
hookUnWrite postReceiveHook
|
||||
unHook
|
||||
deconfigureSmudgeFilter
|
||||
removeRepoUUID
|
||||
removeVersion
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@ git-annex (7.20190913) UNRELEASED; urgency=medium
|
|||
Thanks to Peter Simons for help with analysis of this bug.
|
||||
* When dropping an unlocked file, preserve its mtime, which avoids
|
||||
git status unncessarily running the clean filter on the file.
|
||||
* uninit: Remove several git hooks that git-annex init sets up.
|
||||
* uninit: Remove the smudge and clean filters that git-annex init sets up.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Thu, 19 Sep 2019 11:11:19 -0400
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -47,3 +47,5 @@ I accidentally discovered this after a system upgrade that included the latest v
|
|||
### Have you had any luck using git-annex before? (Sometimes we get tired of reading bug reports all day and a lil' positive end note does wonders)
|
||||
|
||||
I love git-annex (a brilliantly designed piece of software in my view) and have been using it a lot for years!
|
||||
|
||||
> Thanks for pointing out this oversight. [[fixed|done]] --[[Joey]]
|
||||
|
|
Loading…
Add table
Reference in a new issue