display a message in the unlikely scenario of fsking a dead repository
authorJoey Hess <joeyh@joeyh.name>
Tue, 10 Nov 2015 18:44:58 +0000 (14:44 -0400)
committerJoey Hess <joeyh@joeyh.name>
Tue, 10 Nov 2015 18:44:58 +0000 (14:44 -0400)
Command/Fsck.hs
Messages.hs
debian/changelog
doc/bugs/Files_in___34__here__34___not_known_to_git_annex.mdwn
doc/bugs/Files_in___34__here__34___not_known_to_git_annex/comment_3_3b94625acd0fda06545243d9c163cfba._comment [new file with mode: 0644]

index 5561f9160360f3664806384c0a0c55e418fd0584..5a11ce192e0284452fe7424785182b59259360ca 100644 (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
index 650e6162a858ac78818d1c94213a48b960829334..a49f20711b73942c4e4371e98d7283a53facfa66 100644 (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 $
index ae3b8521844a88030f67f75b215b184c1b3cdca2..fd0dad986cd95511f6ca6330686620ba9e7952a1 100644 (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
 
index 8a389025f5c79d1eee3de8a8921dad1e2da47fa9..6fd47cc5aadeed1a36abf2e938cefaa99f513406 100644 (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]]
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 (file)
index 0000000..b08ecd0
--- /dev/null
@@ -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.
+"""]]