Promote file not found warning message to an error.

This commit is contained in:
Joey Hess 2014-09-11 13:36:28 -04:00
parent 79deba1f51
commit 9ed63d1545
5 changed files with 7 additions and 20 deletions

View file

@ -189,10 +189,9 @@ seekHelper :: ([FilePath] -> Git.Repo -> IO ([FilePath], IO Bool)) -> [FilePath]
seekHelper a params = do
ll <- inRepo $ \g ->
runSegmentPaths (\fs -> Git.Command.leaveZombie <$> a fs g) params
{- Show warnings only for files/directories that do not exist. -}
forM_ (map fst $ filter (null . snd) $ zip params ll) $ \p ->
unlessM (isJust <$> liftIO (catchMaybeIO $ getSymbolicLinkStatus p)) $
fileNotFound p
error $ p ++ " not found"
return $ concat ll
notSymlink :: FilePath -> IO Bool

View file

@ -25,7 +25,6 @@ module Messages (
showErr,
warning,
warningIO,
fileNotFound,
indent,
maybeShowJSON,
showFullJSON,
@ -45,7 +44,6 @@ import System.Log.Logger
import System.Log.Formatter
import System.Log.Handler (setFormatter, LogHandler)
import System.Log.Handler.Simple
import qualified Data.Set as S
import Common hiding (handle)
import Types
@ -172,18 +170,6 @@ warningIO w = do
hFlush stdout
hPutStrLn stderr w
{- Displays a warning one time about a file the user specified not existing. -}
fileNotFound :: FilePath -> Annex ()
fileNotFound file = do
st <- Annex.getState Annex.output
let shown = fileNotFoundShown st
when (S.notMember file shown) $ do
let shown' = S.insert file shown
let st' = st { fileNotFoundShown = shown' }
Annex.changeState $ \s -> s { Annex.output = st' }
liftIO $ hPutStrLn stderr $ unwords
[ "git-annex:", file, "not found" ]
indent :: String -> String
indent = intercalate "\n" . map (\l -> " " ++ l) . lines

View file

@ -7,8 +7,6 @@
module Types.Messages where
import qualified Data.Set as S
data OutputType = NormalOutput | QuietOutput | JSONOutput
data SideActionBlock = NoBlock | StartBlock | InBlock
@ -17,8 +15,7 @@ data SideActionBlock = NoBlock | StartBlock | InBlock
data MessageState = MessageState
{ outputType :: OutputType
, sideActionBlock :: SideActionBlock
, fileNotFoundShown :: S.Set FilePath
}
defaultMessageState :: MessageState
defaultMessageState = MessageState NormalOutput NoBlock S.empty
defaultMessageState = MessageState NormalOutput NoBlock

1
debian/changelog vendored
View file

@ -10,6 +10,7 @@ git-annex (5.20140832) UNRELEASED; urgency=medium
* The annex-rsync-transport configuration is now also used when checking
if a key is present on a rsync remote, and when dropping a key from
the remote.
* Promote file not found warning message to an error.
-- Joey Hess <joeyh@debian.org> Thu, 04 Sep 2014 16:17:22 -0400

View file

@ -24,3 +24,7 @@ henry@commsbox:~/work/tmp/test$ echo $?
"""]]
> Ok, I can find no reason why it was implemented as a warning in
> 5f3661238de9f31e6fed0be74fca9d5f1659278c in the bug report associated
> with that commit. So, promoted to error. [[done]] --[[Joey]]