fix bug that turned files already in git into symlinks

This requires a relatively expensive test at file add time to see if it's
in git already. But it can be optimised to only happen during the startup
scan.
This commit is contained in:
Joey Hess 2012-06-12 14:50:54 -04:00
parent 535d9e4998
commit 7d2c813396
2 changed files with 22 additions and 9 deletions

View file

@ -64,6 +64,8 @@ watchDir :: INotify -> FilePath -> (FilePath -> Bool) -> WatchHooks -> IO ()
watchDir i dir ignored hooks
| ignored dir = noop
| otherwise = do
-- Use a lock to make sure events generated during initial
-- scan come before real inotify events.
lock <- newLock
let handler event = withLock lock (void $ go event)
void (addWatch i watchevents dir handler)