assistant: Detect if .git/annex/index is corrupt at startup, and recover.
This commit is contained in:
parent
465a24cc54
commit
18a3e51d52
3 changed files with 12 additions and 0 deletions
|
@ -16,6 +16,7 @@ import Assistant.DaemonStatus
|
||||||
import Assistant.Alert
|
import Assistant.Alert
|
||||||
import Assistant.Repair
|
import Assistant.Repair
|
||||||
import Assistant.Ssh
|
import Assistant.Ssh
|
||||||
|
import qualified Annex.Branch
|
||||||
import qualified Git.LsFiles
|
import qualified Git.LsFiles
|
||||||
import qualified Git.Command
|
import qualified Git.Command
|
||||||
import qualified Git.Config
|
import qualified Git.Config
|
||||||
|
@ -53,6 +54,12 @@ sanityCheckerStartupThread startupdelay = namedThreadUnchecked "SanityCheckerSta
|
||||||
debug ["no index file; restaging"]
|
debug ["no index file; restaging"]
|
||||||
modifyDaemonStatus_ $ \s -> s { forceRestage = True }
|
modifyDaemonStatus_ $ \s -> s { forceRestage = True }
|
||||||
)
|
)
|
||||||
|
{- If the git-annex index file is corrupt, it's ok to remove it;
|
||||||
|
- the data from the git-annex branch will be used, and the index
|
||||||
|
- will be automatically regenerated. -}
|
||||||
|
unlessM (liftAnnex $ Annex.Branch.withIndex $ inRepo $ Git.Repair.checkIndexFast) $ do
|
||||||
|
notice ["corrupt annex/index file found at startup; removing"]
|
||||||
|
liftAnnex $ liftIO . nukeFile =<< fromRepo gitAnnexIndex
|
||||||
|
|
||||||
{- Fix up ssh remotes set up by past versions of the assistant. -}
|
{- Fix up ssh remotes set up by past versions of the assistant. -}
|
||||||
liftIO $ fixUpSshRemotes
|
liftIO $ fixUpSshRemotes
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -13,6 +13,8 @@ git-annex (5.20140108) UNRELEASED; urgency=medium
|
||||||
environment. This typically resulted in git-annex branch log files being
|
environment. This typically resulted in git-annex branch log files being
|
||||||
committed to the master branch and later showing up in the work tree.
|
committed to the master branch and later showing up in the work tree.
|
||||||
(These log files can be safely removed.)
|
(These log files can be safely removed.)
|
||||||
|
* assistant: Detect if .git/annex/index is corrupt at startup, and
|
||||||
|
recover.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Wed, 08 Jan 2014 13:13:54 -0400
|
-- Joey Hess <joeyh@debian.org> Wed, 08 Jan 2014 13:13:54 -0400
|
||||||
|
|
||||||
|
|
|
@ -48,3 +48,6 @@ NetWatcherFallback crashed: user error (git ["--git-dir=/Users/juh/Share/.git","
|
||||||
|
|
||||||
# End of transcript or log.
|
# End of transcript or log.
|
||||||
"""]]
|
"""]]
|
||||||
|
|
||||||
|
> Made assistant detect corrupted .git/annex/index on startup and correct
|
||||||
|
> it. [[fixed|done]] --[[Joey]]
|
||||||
|
|
Loading…
Add table
Reference in a new issue