Windows: Avoid terminating git-annex branch lines with \r\n when union merging.

This commit is contained in:
Joey Hess 2016-05-27 15:22:29 -04:00
parent 45308ec78b
commit 84f20c9f69
Failed to extract signature
4 changed files with 26 additions and 0 deletions

View file

@ -5,6 +5,8 @@
- Licensed under the GNU GPL version 3 or higher.
-}
{-# LANGUAGE CPP #-}
module Git.HashObject where
import Common
@ -39,6 +41,10 @@ hashFile h file = CoProcess.query h send receive
- interface does not allow batch hashing without using temp files. -}
hashBlob :: HashObjectHandle -> String -> IO Sha
hashBlob h s = withTmpFile "hash" $ \tmp tmph -> do
fileEncoding tmph
#ifdef mingw32_HOST_OS
hSetNewlineMode tmph noNewlineTranslation
#endif
hPutStr tmph s
hClose tmph
hashFile h tmp