work around windows having infected git's plumbing

Work around git cat-file --batch's odd stripping of carriage return from
the end of the line (some windows infection), avoiding crashing when the
repo contains a filename ending in a carriage return.
This commit is contained in:
Joey Hess 2019-10-08 15:27:05 -04:00
parent 9a87b3ad31
commit f4dd7d5191
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
4 changed files with 55 additions and 0 deletions

View file

@ -132,6 +132,10 @@ query hdl object newlinefallback receive
-- filename itself contains a newline, have to fall back to another
-- method of getting the information.
| '\n' `elem` s = newlinefallback
-- git strips carriage return from the end of a line, out of some
-- misplaced desire to support windows, so also use the newline
-- fallback for those.
| "\r" `isSuffixOf` s = newlinefallback
| otherwise = CoProcess.query hdl send receive
where
send to = hPutStrLn to s