From 0893820812c9cc10287c861dccbdae3c287cd7cf Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 15 Nov 2010 18:37:49 -0400 Subject: fsck: Print warnings to stderr; --quiet can now be used to only see problems. --- Backend/File.hs | 4 ++-- Backend/SHA1.hs | 2 +- Backend/WORM.hs | 2 +- Command/Unused.hs | 6 ++---- Messages.hs | 4 +++- debian/changelog | 2 ++ doc/walkthrough.mdwn | 10 +++++----- 7 files changed, 16 insertions(+), 14 deletions(-) diff --git a/Backend/File.hs b/Backend/File.hs index 835177856..c67fb3ce3 100644 --- a/Backend/File.hs +++ b/Backend/File.hs @@ -175,12 +175,12 @@ checkKeyNumCopies key = do let present = length remotes + if inannex then 1 else 0 if (present < needed) then do - showLongNote $ note present needed + warning $ note present needed return False else return True where note 0 _ = "** No known copies of the file exist!" note present needed = "Only " ++ show present ++ " of " ++ show needed ++ - " copies exist. " ++ + " copies of "++show key++" exist. " ++ "Run git annex get somewhere else to back it up." diff --git a/Backend/SHA1.hs b/Backend/SHA1.hs index 9e9000ba9..46667c9cd 100644 --- a/Backend/SHA1.hs +++ b/Backend/SHA1.hs @@ -57,5 +57,5 @@ checkKeySHA1 key = do then return True else do dest <- moveBad key - showLongNote $ "Bad file content; moved to "++dest + warning $ "Bad file content; moved to "++dest return False diff --git a/Backend/WORM.hs b/Backend/WORM.hs index 374989996..4e2177fed 100644 --- a/Backend/WORM.hs +++ b/Backend/WORM.hs @@ -66,5 +66,5 @@ checkKeySize key = do then return True else do dest <- moveBad key - showLongNote $ "Bad file size; moved to "++dest + warning $ "Bad file size; moved to "++dest return False diff --git a/Command/Unused.hs b/Command/Unused.hs index 7a34d393c..ae189550c 100644 --- a/Command/Unused.hs +++ b/Command/Unused.hs @@ -28,10 +28,8 @@ start = do perform :: SubCmdPerform perform = do - ok <- checkUnused - if ok - then return $ Just $ return True - else return Nothing + _ <- checkUnused + return $ Just $ return True checkUnused :: Annex Bool checkUnused = do diff --git a/Messages.hs b/Messages.hs index ed4f3b90a..7dafa8284 100644 --- a/Messages.hs +++ b/Messages.hs @@ -54,4 +54,6 @@ showErr :: (Show a) => a -> Annex () showErr e = warning $ show e warning :: String -> Annex () -warning s = liftIO $ hPutStrLn stderr $ "git-annex: " ++ s +warning s = do + verbose $ liftIO $ putStr "\n" + liftIO $ hPutStrLn stderr $ "git-annex: " ++ s diff --git a/debian/changelog b/debian/changelog index b6a426d1f..a6d95ab69 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ git-annex (0.07) UNRELEASED; urgency=low * unused: New subcommand, finds unused data. (Split out from fsck.) * dropunused: New subcommand, provides for easy dropping of unused keys by number, as listed by the unused subcommand. + * fsck: Print warnings to stderr; --quiet can now be used to only see + problems. -- Joey Hess Sun, 14 Nov 2010 12:34:49 -0400 diff --git a/doc/walkthrough.mdwn b/doc/walkthrough.mdwn index a1a888242..281f46050 100644 --- a/doc/walkthrough.mdwn +++ b/doc/walkthrough.mdwn @@ -296,7 +296,7 @@ eliminate it to save space. 2 WORM:1289672605:14:file (To see where data was previously used, try: git log --stat -S'KEY') (To remove unwanted data: git-annex dropunused NUMBER) - failed + ok After running `git annex unused`, you can follow the instructions to examine the history of files that used the data, and if you decide you don't need that @@ -316,7 +316,7 @@ setting is satisfied for all files. # git annex fsck unused (checking for unused data...) ok fsck my_cool_big_file (checksum...) ok - ...... + ... You can also specifiy the files to check. This is particularly useful if you're using sha1 and don't want to spend a long time checksumming everything. @@ -332,10 +332,10 @@ might say about a badly messed up annex: # git annex fsck fsck my_cool_big_file (checksum...) - Bad file content; moved to .git/annex/bad/SHA1:7da006579dd64330eb2456001fd01948430572f2 - ** No known copies of the file exist! + git-annex: Bad file content; moved to .git/annex/bad/SHA1:7da006579dd64330eb2456001fd01948430572f2 + git-annex: ** No known copies of the file exist! failed fsck important_file - Only 1 of 2 copies exist. Run git annex get somewhere else to back it up. + git-annex: Only 1 of 2 copies exist. Run git annex get somewhere else to back it up. failed git-annex: 2 failed -- cgit v1.2.3