display a message in the unlikely scenario of fsking a dead repository

This commit is contained in:
Joey Hess 2015-11-10 14:44:58 -04:00
parent 468e52fbe3
commit 4b02af57b6
Failed to extract signature
5 changed files with 30 additions and 1 deletions

View file

@ -90,6 +90,7 @@ seek :: FsckOptions -> CommandSeek
seek o = allowConcurrentOutput $ do
from <- maybe (pure Nothing) (Just <$$> getParsed) (fsckFromOption o)
u <- maybe getUUID (pure . Remote.uuid) from
checkDeadRepo u
i <- prepIncremental u (incrementalOpt o)
withKeyOptions (keyOptions o) False
(\k -> startKey i k =<< getNumCopies)
@ -98,6 +99,11 @@ seek o = allowConcurrentOutput $ do
cleanupIncremental i
void $ tryIO $ recordActivity Fsck u
checkDeadRepo :: UUID -> Annex ()
checkDeadRepo u =
whenM ((==) DeadTrusted <$> lookupTrust u) $
earlyWarning "Warning: Fscking a repository that is currently marked as dead."
start :: Maybe Remote -> Incremental -> FilePath -> Key -> CommandStart
start from inc file key = do
v <- Backend.getBackend file key

View file

@ -22,6 +22,7 @@ module Messages (
endResult,
toplevelWarning,
warning,
earlyWarning,
warningIO,
indent,
maybeShowJSON,
@ -124,6 +125,9 @@ toplevelWarning makeway s = warning' makeway ("git-annex: " ++ s)
warning :: String -> Annex ()
warning = warning' True . indent
earlyWarning :: String -> Annex ()
earlyWarning = warning' False
warning' :: Bool -> String -> Annex ()
warning' makeway w = do
when makeway $

3
debian/changelog vendored
View file

@ -23,7 +23,8 @@ git-annex (5.20151102.2) UNRELEASED; urgency=medium
* Make git-annex-standalone.deb include the git-annex html documentation,
desktop file, and base completion file, same as the regular git-annex.deb.
* fsck: When fscking a dead repo, avoid incorrect "fixing location log"
message.
message, and display a message, since it's unusual to have access to a
dead repo.
-- Joey Hess <id@joeyh.name> Wed, 04 Nov 2015 12:50:20 -0400

View file

@ -48,3 +48,5 @@ File system is ext4.
### What version of git-annex are you using? On what operating system?
git-annex version: 5.20151019-1, Debian unstable.
> improved fsck output [[done]] --[[Joey]]

View file

@ -0,0 +1,16 @@
[[!comment format=mdwn
username="joey"
subject="""comment 3"""
date="2015-11-10T18:06:36Z"
content="""
Aha, there is a bug indeed; fscking a dead repository always claims to
be "fixing location log", but the location log is fine and doesn't need
fixing. Fixed that.
As to discovering when you're in a dead repository, there are a lot of
things that could be done, but most of them seem to add special cases
that are complicating both to implement and for parsing the resulting
output (like putting "(dead)" next to the description/name of a
dead repository). Seems reasonable to have fsck note when the repository
it's checking is dead, and leave it at that.
"""]]