escape slashes in annex pointer files

The problem with having the slashes unescaped is, it broke parsing, since
the parser takes the filename to get the part containing the key.
That particularly affected URL keys.

This makes the format be the same as symlinks point to, which keeps things
simple.

Existing pointer files will continue to work ok.
This commit is contained in:
Joey Hess 2016-02-16 14:10:08 -04:00
parent 32dcc1303a
commit adc27f081a
Failed to extract signature

View file

@ -147,7 +147,7 @@ parseLinkOrPointer' :: String -> Maybe Key
parseLinkOrPointer' = go . fromInternalGitPath . takeWhile (not . lineend)
where
go l
| isLinkToAnnex l = file2key $ takeFileName l
| isLinkToAnnex l = fileKey $ takeFileName l
| otherwise = Nothing
lineend '\n' = True
lineend '\r' = True
@ -155,7 +155,7 @@ parseLinkOrPointer' = go . fromInternalGitPath . takeWhile (not . lineend)
formatPointer :: Key -> String
formatPointer k =
toInternalGitPath (pathSeparator:objectDir </> key2file k) ++ "\n"
toInternalGitPath (pathSeparator:objectDir </> keyFile k) ++ "\n"
{- Checks if a file is a pointer to a key. -}
isPointerFile :: FilePath -> IO (Maybe Key)