make --force really bypass lsof check
This commit is contained in:
parent
02e9fdb0a5
commit
a5cceb7d4f
1 changed files with 11 additions and 7 deletions
|
@ -7,6 +7,7 @@ module Assistant.Committer where
|
||||||
|
|
||||||
import Common.Annex
|
import Common.Annex
|
||||||
import Assistant.ThreadedMonad
|
import Assistant.ThreadedMonad
|
||||||
|
import qualified Annex
|
||||||
import qualified Annex.Queue
|
import qualified Annex.Queue
|
||||||
import qualified Git.Command
|
import qualified Git.Command
|
||||||
import qualified Command.Add
|
import qualified Command.Add
|
||||||
|
@ -153,18 +154,21 @@ handleAdds st changechan cs
|
||||||
|
|
||||||
{- Checks which of a set of files can safely be added.
|
{- Checks which of a set of files can safely be added.
|
||||||
- Files are locked down as hard links in a temp directory,
|
- Files are locked down as hard links in a temp directory,
|
||||||
- with their write bits disabled. But some may have already
|
- with their write bits disabled. But some may still be
|
||||||
- been opened for write, so lsof is run on the temp directory
|
- opened for write, so lsof is run on the temp directory
|
||||||
- to check them.
|
- to check them.
|
||||||
-}
|
-}
|
||||||
safeToAdd :: ThreadState -> [FilePath] -> IO [KeySource]
|
safeToAdd :: ThreadState -> [FilePath] -> IO [KeySource]
|
||||||
safeToAdd st files = do
|
safeToAdd st files = do
|
||||||
locked <- catMaybes <$> lockdown files
|
locked <- catMaybes <$> lockdown files
|
||||||
runThreadState st $ do
|
runThreadState st $ ifM (Annex.getState Annex.force)
|
||||||
tmpdir <- fromRepo gitAnnexTmpDir
|
( return locked -- force bypasses lsof check
|
||||||
open <- S.fromList . map fst3 . filter openwrite <$>
|
, do
|
||||||
liftIO (Lsof.queryDir tmpdir)
|
tmpdir <- fromRepo gitAnnexTmpDir
|
||||||
catMaybes <$> forM locked (go open)
|
open <- S.fromList . map fst3 . filter openwrite <$>
|
||||||
|
liftIO (Lsof.queryDir tmpdir)
|
||||||
|
catMaybes <$> forM locked (go open)
|
||||||
|
)
|
||||||
where
|
where
|
||||||
go open keysource
|
go open keysource
|
||||||
| S.member (contentLocation keysource) open = do
|
| S.member (contentLocation keysource) open = do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue