This matches the behavior of git on Windows, which does not end lines with
CR either.
Previously, git-annex used to always write lines with putStrLn, so would
output CR on Windows. Then parts of it changed to use ByteString.putStrLn,
which does not output CR. That left its output inconsistent, sometimes
within the same command.
The point of this commit is to get back to consistency. Having the same
behavior as git is a nice bonus. It would be much harder to make it
consistently output CR, because every place it uses ByteString.putStrLn or
similar would need to be changed.
Sponsored-by: Nicholas Golder-Manning on Patreon
* importfeed: Use caching database to avoid needing to list urls
on every run, and avoid using too much memory.
* Improve memory use of --all when using annex.private.
+ * Windows: Consistently avoid ending output lines with CR. This matches
+ the behavior of git on Windows, which does not end lines with CR
+ either.
* Windows: Fix CRLF handling in some log files.
-- Joey Hess <id@joeyh.name> Tue, 10 Oct 2023 13:17:31 -0400
- Licensed under the GNU AGPL version 3 or higher.
-}
-{-# LANGUAGE OverloadedStrings, ScopedTypeVariables #-}
+{-# LANGUAGE OverloadedStrings, ScopedTypeVariables, CPP #-}
module Messages (
showStartMessage,
- a file or a pipe. -}
hSetBuffering stdout LineBuffering
hSetBuffering stderr LineBuffering
+#ifdef mingw32_HOST_OS
+ {- Avoid outputting CR at end of line on Windows. git commands do
+ - not ouput CR there. -}
+ hSetNewlineMode stdout noNewlineTranslation
+ hSetNewlineMode stderr noNewlineTranslation
+#endif
enableDebugOutput :: Annex ()
enableDebugOutput = do