allow \r in pointer files

git-annex doesn't write \r, but it can be present due to line ending
conversions or perhaps user edits.
This commit is contained in:
Joey Hess 2016-02-15 16:36:14 -04:00
parent cceff0e46c
commit 4d89a1ffd1
Failed to extract signature

View file

@ -143,11 +143,14 @@ parseLinkOrPointer = parseLinkOrPointer' . decodeBS . L.take maxsz
maxsz = 81920
parseLinkOrPointer' :: String -> Maybe Key
parseLinkOrPointer' s = headMaybe (lines (fromInternalGitPath s)) >>= go
parseLinkOrPointer' = go . fromInternalGitPath . takeWhile (not . lineend)
where
go l
| isLinkToAnnex l = file2key $ takeFileName l
| otherwise = Nothing
lineend '\n' = True
lineend '\r' = True
lineend _ = False
formatPointer :: Key -> String
formatPointer k =