avoid writing new line to upgrade.log when upgrade is deferred

With automatic upgrades to v10 enabled, this could have led to each
run of git-annex adding a line to upgrade.log for v9. However,
they're not yet, so it only happened when running git-annex upgrade
in a v9 repository.

Sponsored-by: Brock Spratlen on Patreon
This commit is contained in:
Joey Hess 2022-07-25 16:01:48 -04:00
parent 61b55d62d7
commit df3020fb7e
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -67,10 +67,11 @@ needsUpgrade v
upgrade :: Bool -> RepoVersion -> Annex Bool
upgrade automatic destversion = do
(upgraded, newversion) <- go =<< getVersion
when upgraded $
startversion <- getVersion
(ok, newversion) <- go startversion
when (ok && newversion /= startversion) $
postupgrade newversion
return upgraded
return ok
where
go (Just v)
| v >= destversion = return (True, Just v)