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:
parent
cceff0e46c
commit
4d89a1ffd1
1 changed files with 4 additions and 1 deletions
|
@ -143,11 +143,14 @@ parseLinkOrPointer = parseLinkOrPointer' . decodeBS . L.take maxsz
|
||||||
maxsz = 81920
|
maxsz = 81920
|
||||||
|
|
||||||
parseLinkOrPointer' :: String -> Maybe Key
|
parseLinkOrPointer' :: String -> Maybe Key
|
||||||
parseLinkOrPointer' s = headMaybe (lines (fromInternalGitPath s)) >>= go
|
parseLinkOrPointer' = go . fromInternalGitPath . takeWhile (not . lineend)
|
||||||
where
|
where
|
||||||
go l
|
go l
|
||||||
| isLinkToAnnex l = file2key $ takeFileName l
|
| isLinkToAnnex l = file2key $ takeFileName l
|
||||||
| otherwise = Nothing
|
| otherwise = Nothing
|
||||||
|
lineend '\n' = True
|
||||||
|
lineend '\r' = True
|
||||||
|
lineend _ = False
|
||||||
|
|
||||||
formatPointer :: Key -> String
|
formatPointer :: Key -> String
|
||||||
formatPointer k =
|
formatPointer k =
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue