From ff6ce2bc15eb8efa9fac0a265407adb6786a0b8b Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 4 Mar 2013 23:27:18 -0400 Subject: [PATCH] print a warning message when garbage is received from configlist --- Messages.hs | 7 +++++++ Remote/Git.hs | 11 +++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Messages.hs b/Messages.hs index 63c6281085..d79c91aa03 100644 --- a/Messages.hs +++ b/Messages.hs @@ -23,6 +23,7 @@ module Messages ( showEndResult, showErr, warning, + warningIO, fileNotFound, indent, maybeShowJSON, @@ -158,6 +159,12 @@ warning' w = do hFlush stdout hPutStrLn stderr w +warningIO :: String -> IO () +warningIO w = do + putStr "\n" + hFlush stdout + hPutStrLn stderr w + {- Displays a warning one time about a file the user specified not existing. -} fileNotFound :: FilePath -> Annex () fileNotFound file = do diff --git a/Remote/Git.hs b/Remote/Git.hs index 7f9f95e2a5..d39e0afe26 100644 --- a/Remote/Git.hs +++ b/Remote/Git.hs @@ -161,8 +161,15 @@ tryGitConfigRead r =<< liftIO (try a :: IO (Either SomeException Git.Repo)) pipedconfig cmd params = - withHandle StdoutHandle createProcessSuccess p $ - Git.Config.hRead r + withHandle StdoutHandle createProcessSuccess p $ \h -> do + fileEncoding h + val <- hGetContentsStrict h + r' <- Git.Config.store val r + when (getUncachedUUID r' == NoUUID && not (null val)) $ do + warningIO $ "Failed to get annex.uuid configuration of repository " ++ Git.repoDescribe r + warningIO $ "Instead, got: " ++ show val + warningIO $ "This is unexpected; please check the network transport!" + return r' where p = proc cmd $ toCommand params