summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-02-15 16:36:14 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-02-15 16:37:40 -0400
commit32fbc9664365e70ca94b159506f0d0299596bcf4 (patch)
treefa326371036aa084b3c48e5b39aa6926c80a492a
parent05ba2ecd79fd82ef66d82a586e5f48cc011dc646 (diff)
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.
-rw-r--r--Annex/Link.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/Annex/Link.hs b/Annex/Link.hs
index 4a3311af9..82543257d 100644
--- a/Annex/Link.hs
+++ b/Annex/Link.hs
@@ -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 =