summaryrefslogtreecommitdiff
path: root/Assistant/Committer.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-06-19 00:23:14 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-06-19 00:23:14 -0400
commita5cceb7d4ff83b11da95cac204e99d1bfdbaecc9 (patch)
tree5f88029d363cb98d8a9dc0233cd0154ebe0d81f9 /Assistant/Committer.hs
parent02e9fdb0a5940a1c059445c616338dc147a32544 (diff)
make --force really bypass lsof check
Diffstat (limited to 'Assistant/Committer.hs')
-rw-r--r--Assistant/Committer.hs18
1 files changed, 11 insertions, 7 deletions
diff --git a/Assistant/Committer.hs b/Assistant/Committer.hs
index a2b65dae5..b482e5e7a 100644
--- a/Assistant/Committer.hs
+++ b/Assistant/Committer.hs
@@ -7,6 +7,7 @@ module Assistant.Committer where
import Common.Annex
import Assistant.ThreadedMonad
+import qualified Annex
import qualified Annex.Queue
import qualified Git.Command
import qualified Command.Add
@@ -153,18 +154,21 @@ handleAdds st changechan cs
{- Checks which of a set of files can safely be added.
- Files are locked down as hard links in a temp directory,
- - with their write bits disabled. But some may have already
- - been opened for write, so lsof is run on the temp directory
+ - with their write bits disabled. But some may still be
+ - opened for write, so lsof is run on the temp directory
- to check them.
-}
safeToAdd :: ThreadState -> [FilePath] -> IO [KeySource]
safeToAdd st files = do
locked <- catMaybes <$> lockdown files
- runThreadState st $ do
- tmpdir <- fromRepo gitAnnexTmpDir
- open <- S.fromList . map fst3 . filter openwrite <$>
- liftIO (Lsof.queryDir tmpdir)
- catMaybes <$> forM locked (go open)
+ runThreadState st $ ifM (Annex.getState Annex.force)
+ ( return locked -- force bypasses lsof check
+ , do
+ tmpdir <- fromRepo gitAnnexTmpDir
+ open <- S.fromList . map fst3 . filter openwrite <$>
+ liftIO (Lsof.queryDir tmpdir)
+ catMaybes <$> forM locked (go open)
+ )
where
go open keysource
| S.member (contentLocation keysource) open = do