ignore .gitignore and .gitattributes
This commit is contained in:
parent
b819f644ad
commit
db8effb8f3
2 changed files with 14 additions and 13 deletions
|
@ -43,14 +43,17 @@ start = notBareRepo $ do
|
||||||
mvar <- liftIO $ newMVar state
|
mvar <- liftIO $ newMVar state
|
||||||
next $ next $ liftIO $ withINotify $ \i -> do
|
next $ next $ liftIO $ withINotify $ \i -> do
|
||||||
let hook a = Just $ runAnnex mvar a
|
let hook a = Just $ runAnnex mvar a
|
||||||
watchDir i "." (not . pruned)
|
watchDir i "." (ignored . takeFileName)
|
||||||
(hook onAdd) (hook onAddSymlink)
|
(hook onAdd) (hook onAddSymlink)
|
||||||
(hook onDel) (hook onDelDir)
|
(hook onDel) (hook onDelDir)
|
||||||
putStrLn "(started)"
|
putStrLn "(started)"
|
||||||
waitForTermination
|
waitForTermination
|
||||||
return True
|
return True
|
||||||
where
|
where
|
||||||
pruned dir = takeFileName dir /= ".git"
|
ignored ".git" = True
|
||||||
|
ignored ".gitignore" = True
|
||||||
|
ignored ".gitattributes" = True
|
||||||
|
ignored _ = False
|
||||||
|
|
||||||
{- Runs a handler, inside the Annex monad.
|
{- Runs a handler, inside the Annex monad.
|
||||||
-
|
-
|
||||||
|
|
|
@ -48,9 +48,7 @@ type Hook = Maybe (FilePath -> IO ())
|
||||||
- So this will fail if there are too many subdirectories.
|
- So this will fail if there are too many subdirectories.
|
||||||
-}
|
-}
|
||||||
watchDir :: INotify -> FilePath -> (FilePath -> Bool) -> Hook -> Hook -> Hook -> Hook -> IO ()
|
watchDir :: INotify -> FilePath -> (FilePath -> Bool) -> Hook -> Hook -> Hook -> Hook -> IO ()
|
||||||
watchDir i dir ignored add addsymlink del deldir
|
watchDir i dir ignored add addsymlink del deldir = unless (ignored dir) $ do
|
||||||
| ignored dir = noop
|
|
||||||
| otherwise = do
|
|
||||||
lock <- newLock
|
lock <- newLock
|
||||||
void $ addWatch i watchevents dir $ \event ->
|
void $ addWatch i watchevents dir $ \event ->
|
||||||
withLock lock (void $ go event)
|
withLock lock (void $ go event)
|
||||||
|
@ -71,7 +69,7 @@ watchDir i dir ignored add addsymlink del deldir
|
||||||
| isJust del || isJust deldir = [MoveOut, Delete]
|
| isJust del || isJust deldir = [MoveOut, Delete]
|
||||||
| otherwise = []
|
| otherwise = []
|
||||||
|
|
||||||
walk f = do
|
walk f = unless (ignored f) $ do
|
||||||
let fullf = indir f
|
let fullf = indir f
|
||||||
r <- catchMaybeIO $ getSymbolicLinkStatus fullf
|
r <- catchMaybeIO $ getSymbolicLinkStatus fullf
|
||||||
case r of
|
case r of
|
||||||
|
@ -112,7 +110,7 @@ watchDir i dir ignored add addsymlink del deldir
|
||||||
guarded = unlessM (filetype (const True) f)
|
guarded = unlessM (filetype (const True) f)
|
||||||
go _ = noop
|
go _ = noop
|
||||||
|
|
||||||
Just a <@> f = a $ indir f
|
Just a <@> f = unless (ignored f) $ a $ indir f
|
||||||
Nothing <@> _ = noop
|
Nothing <@> _ = noop
|
||||||
|
|
||||||
indir f = dir </> f
|
indir f = dir </> f
|
||||||
|
|
Loading…
Add table
Reference in a new issue