fef3cd055d
debian oldoldstable has 2.1, and that's what i386ancient uses. It would be better to require git 2.2, which is needed to use adjusted branches, but can't do that w/o losing support for some old linux kernels or a complicated git backport.
37 lines
995 B
Haskell
37 lines
995 B
Haskell
{- git check-ignore interface, with handle automatically stored in
|
|
- the Annex monad
|
|
-
|
|
- Copyright 2013 Joey Hess <id@joeyh.name>
|
|
-
|
|
- Licensed under the GNU AGPL version 3 or higher.
|
|
-}
|
|
|
|
module Annex.CheckIgnore (
|
|
checkIgnored,
|
|
checkIgnoreHandle,
|
|
checkIgnoreStop
|
|
) where
|
|
|
|
import Annex.Common
|
|
import qualified Git.CheckIgnore as Git
|
|
import qualified Annex
|
|
|
|
checkIgnored :: FilePath -> Annex Bool
|
|
checkIgnored file = go =<< checkIgnoreHandle
|
|
where
|
|
go h = liftIO $ Git.checkIgnored h file
|
|
|
|
checkIgnoreHandle :: Annex Git.CheckIgnoreHandle
|
|
checkIgnoreHandle = maybe startup return =<< Annex.getState Annex.checkignorehandle
|
|
where
|
|
startup = do
|
|
h <- inRepo Git.checkIgnoreStart
|
|
Annex.changeState $ \s -> s { Annex.checkignorehandle = Just h }
|
|
return h
|
|
|
|
checkIgnoreStop :: Annex ()
|
|
checkIgnoreStop = maybe noop stop =<< Annex.getState Annex.checkignorehandle
|
|
where
|
|
stop h = do
|
|
liftIO $ Git.checkIgnoreStop h
|
|
Annex.changeState $ \s -> s { Annex.checkignorehandle = Nothing }
|