From 4b02af57b6573ea5b5d64bbeecf9c977e672253d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 10 Nov 2015 14:44:58 -0400 Subject: [PATCH] display a message in the unlikely scenario of fsking a dead repository --- Command/Fsck.hs | 6 ++++++ Messages.hs | 4 ++++ debian/changelog | 3 ++- ...___34__here__34___not_known_to_git_annex.mdwn | 2 ++ ...t_3_3b94625acd0fda06545243d9c163cfba._comment | 16 ++++++++++++++++ 5 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 doc/bugs/Files_in___34__here__34___not_known_to_git_annex/comment_3_3b94625acd0fda06545243d9c163cfba._comment diff --git a/Command/Fsck.hs b/Command/Fsck.hs index 5561f91603..5a11ce192e 100644 --- a/Command/Fsck.hs +++ b/Command/Fsck.hs @@ -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 diff --git a/Messages.hs b/Messages.hs index 650e6162a8..a49f20711b 100644 --- a/Messages.hs +++ b/Messages.hs @@ -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 $ diff --git a/debian/changelog b/debian/changelog index ae3b852184..fd0dad986c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Wed, 04 Nov 2015 12:50:20 -0400 diff --git a/doc/bugs/Files_in___34__here__34___not_known_to_git_annex.mdwn b/doc/bugs/Files_in___34__here__34___not_known_to_git_annex.mdwn index 8a389025f5..6fd47cc5aa 100644 --- a/doc/bugs/Files_in___34__here__34___not_known_to_git_annex.mdwn +++ b/doc/bugs/Files_in___34__here__34___not_known_to_git_annex.mdwn @@ -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]] diff --git a/doc/bugs/Files_in___34__here__34___not_known_to_git_annex/comment_3_3b94625acd0fda06545243d9c163cfba._comment b/doc/bugs/Files_in___34__here__34___not_known_to_git_annex/comment_3_3b94625acd0fda06545243d9c163cfba._comment new file mode 100644 index 0000000000..b08ecd0523 --- /dev/null +++ b/doc/bugs/Files_in___34__here__34___not_known_to_git_annex/comment_3_3b94625acd0fda06545243d9c163cfba._comment @@ -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. +"""]]