avoid crashing committer if it fails to stage changes
Just retry later.
This commit is contained in:
parent
9aab70de66
commit
9a3471971b
1 changed files with 21 additions and 15 deletions
|
@ -30,6 +30,7 @@ import qualified Utility.Lsof as Lsof
|
||||||
import qualified Utility.DirWatcher as DirWatcher
|
import qualified Utility.DirWatcher as DirWatcher
|
||||||
import Types.KeySource
|
import Types.KeySource
|
||||||
import Config
|
import Config
|
||||||
|
import Annex.Exception
|
||||||
|
|
||||||
import Data.Time.Clock
|
import Data.Time.Clock
|
||||||
import Data.Tuple.Utils
|
import Data.Tuple.Utils
|
||||||
|
@ -81,18 +82,23 @@ commitThread st changechan commitchan transferqueue dstatus = thread $ do
|
||||||
|
|
||||||
commitStaged :: Annex Bool
|
commitStaged :: Annex Bool
|
||||||
commitStaged = do
|
commitStaged = do
|
||||||
Annex.Queue.flush
|
{- This could fail if there's another commit being made by
|
||||||
void $ inRepo $ Git.Command.runBool "commit" $ nomessage
|
- something else. -}
|
||||||
[ Param "--quiet"
|
v <- tryAnnex Annex.Queue.flush
|
||||||
{- Avoid running the usual git-annex pre-commit hook;
|
case v of
|
||||||
- watch does the same symlink fixing, and we don't want
|
Left _ -> return False
|
||||||
- to deal with unlocked files in these commits. -}
|
Right _ -> do
|
||||||
, Param "--no-verify"
|
void $ inRepo $ Git.Command.runBool "commit" $ nomessage
|
||||||
]
|
[ Param "--quiet"
|
||||||
{- Empty commits may be made if tree changes cancel
|
{- Avoid running the usual git-annex pre-commit hook;
|
||||||
- each other out, etc. Git returns nonzero on those, so
|
- watch does the same symlink fixing, and we don't want
|
||||||
- don't propigate out commit failures. -}
|
- to deal with unlocked files in these commits. -}
|
||||||
return True
|
, Param "--no-verify"
|
||||||
|
]
|
||||||
|
{- Empty commits may be made if tree changes cancel
|
||||||
|
- each other out, etc. Git returns nonzero on those,
|
||||||
|
- so don't propigate out commit failures. -}
|
||||||
|
return True
|
||||||
where
|
where
|
||||||
nomessage ps
|
nomessage ps
|
||||||
| Git.Version.older "1.7.2" = Param "-m"
|
| Git.Version.older "1.7.2" = Param "-m"
|
||||||
|
@ -185,7 +191,7 @@ handleAdds delayadd st changechan transferqueue dstatus cs = returnWhen (null in
|
||||||
sanitycheck ks $ runThreadState st $ do
|
sanitycheck ks $ runThreadState st $ do
|
||||||
showStart "add" $ keyFilename ks
|
showStart "add" $ keyFilename ks
|
||||||
key <- Command.Add.ingest ks
|
key <- Command.Add.ingest ks
|
||||||
handle (finishedChange change) (keyFilename ks) key
|
done (finishedChange change) (keyFilename ks) key
|
||||||
where
|
where
|
||||||
{- Add errors tend to be transient and will
|
{- Add errors tend to be transient and will
|
||||||
- be automatically dealt with, so don't
|
- be automatically dealt with, so don't
|
||||||
|
@ -194,10 +200,10 @@ handleAdds delayadd st changechan transferqueue dstatus cs = returnWhen (null in
|
||||||
ret _ = (True, Nothing)
|
ret _ = (True, Nothing)
|
||||||
add _ = return Nothing
|
add _ = return Nothing
|
||||||
|
|
||||||
handle _ _ Nothing = do
|
done _ _ Nothing = do
|
||||||
showEndFail
|
showEndFail
|
||||||
return Nothing
|
return Nothing
|
||||||
handle change file (Just key) = do
|
done change file (Just key) = do
|
||||||
link <- Command.Add.link file key True
|
link <- Command.Add.link file key True
|
||||||
when DirWatcher.eventsCoalesce $ do
|
when DirWatcher.eventsCoalesce $ do
|
||||||
sha <- inRepo $
|
sha <- inRepo $
|
||||||
|
|
Loading…
Reference in a new issue