aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-09-06 13:46:08 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-09-06 13:46:08 -0400
commit07125dca53ece4896a83fad00b7f43101855ce9c (patch)
treec74bd30e459589239134f3e01603e8e8cc122ec7
parent14f75ced75aa73d4f8dbc45cdc697bac1535fb37 (diff)
Improve display of newlines around error and warning messages.
-rw-r--r--CmdLine.hs2
-rw-r--r--Command.hs1
-rw-r--r--Messages.hs11
-rw-r--r--debian/changelog6
-rw-r--r--doc/bugs/fsck_output.mdwn10
5 files changed, 23 insertions, 7 deletions
diff --git a/CmdLine.hs b/CmdLine.hs
index 2652e5b8f..4ccd2c2c2 100644
--- a/CmdLine.hs
+++ b/CmdLine.hs
@@ -89,8 +89,8 @@ tryRun' errnum state (a:as) = do
case result of
Left err -> do
Annex.eval state $ do
- showEndFail
showErr err
+ showEndFail
tryRun' (errnum + 1) state as
Right (True,state') -> tryRun' errnum state' as
Right (False,state') -> tryRun' (errnum + 1) state' as
diff --git a/Command.hs b/Command.hs
index 21c50f9c0..78f9823fb 100644
--- a/Command.hs
+++ b/Command.hs
@@ -103,7 +103,6 @@ doCommand = start
stage a b = b >>= a
success = return True
failure = do
- showOutput -- avoid clutter around error message
showEndFail
return False
diff --git a/Messages.hs b/Messages.hs
index faa4dbcde..492251981 100644
--- a/Messages.hs
+++ b/Messages.hs
@@ -73,16 +73,17 @@ showEndResult b = handle (JSON.end b) $ putStrLn msg
| otherwise = "failed"
showErr :: (Show a) => a -> Annex ()
-showErr e = liftIO $ do
- hFlush stdout
- hPutStrLn stderr $ "git-annex: " ++ show e
+showErr e = warning' $ "git-annex: " ++ show e
warning :: String -> Annex ()
-warning w = do
+warning w = warning' (indent w)
+
+warning' :: String -> Annex ()
+warning' w = do
handle q $ putStr "\n"
liftIO $ do
hFlush stdout
- hPutStrLn stderr $ indent w
+ hPutStrLn stderr w
indent :: String -> String
indent s = join "\n" $ map (\l -> " " ++ l) $ lines s
diff --git a/debian/changelog b/debian/changelog
index 35144f678..9ab3b4fd3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+git-annex (3.20110903) UNRELEASED; urgency=low
+
+ * Improve display of newlines around error and warning messages.
+
+ -- Joey Hess <joeyh@debian.org> Tue, 06 Sep 2011 13:45:16 -0400
+
git-annex (3.20110902) unstable; urgency=low
* Set EMAIL when running test suite so that git does not need to be
diff --git a/doc/bugs/fsck_output.mdwn b/doc/bugs/fsck_output.mdwn
index 90af1600d..1b00dd7b3 100644
--- a/doc/bugs/fsck_output.mdwn
+++ b/doc/bugs/fsck_output.mdwn
@@ -34,3 +34,13 @@ The newline is in the wrong place and confuses the user. It should be printed _a
> failed
>
> --[[Joey]]
+
+>> Well, I fixed this in all cases except a thrown non-IO error (last
+>> example aboce), which output is printed by haskell's runtime. I'd
+>> have to add a second error handler to handle those, and it's not
+>> clear what it would do. Often an error will occur before anything
+>> else is printed, and then the current behavior is right; if something
+>> has been printed it would be nice to have a newline before the error,
+>> but by the time the error is caught we'd be out of the annex monad
+>> and not really have any way to know if something has been printed.
+>> I think my fix is good enough [[done]] --[[Joey]]