upgrade: When upgrade fails due to an exception, display it.

37b42e72e7 made it catch exceptions but
thought they were unlikely to be useful to display, which may be right when
a git command fails, but not in the case yoh found.
This commit is contained in:
Joey Hess 2020-05-07 12:22:32 -04:00
parent 5eb101b720
commit bb88a01910
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
3 changed files with 7 additions and 2 deletions

View file

@ -9,6 +9,7 @@ git-annex (8.20200502) UNRELEASED; urgency=medium
* repair: Improve fetching from a remote with an url in host:path format.
* sync: Avoid an ugly error message when nothing has been committed to
master yet and there is a synced master branch to merge from.
* upgrade: When upgrade fails due to an exception, display it.
-- Joey Hess <id@joeyh.name> Mon, 04 May 2020 12:46:11 -0400

View file

@ -36,7 +36,7 @@ import Annex.AdjustedBranch
import qualified Data.ByteString as S
upgrade :: Bool -> Annex Bool
upgrade automatic = flip catchNonAsync (const $ return False) $ do
upgrade automatic = flip catchNonAsync onexception $ do
unless automatic $
showAction "v5 to v6"
ifM isDirect
@ -55,6 +55,10 @@ upgrade automatic = flip catchNonAsync (const $ return False) $ do
unlessM isDirect $
createInodeSentinalFile True
return True
where
onexception e = do
warning $ "caught exception: " ++ show e
return False
-- git before 2.22 would OOM running git status on a large file.
--

View file

@ -150,4 +150,4 @@ So it seems git-annex should revert back to reporting errors from underlying `gi
[[!meta author=yoh]]
[[!tag projects/datalad]]
> [[fixed|done]], thanks for tracking it back to the root cause. --[[Joey]]