Fix querying git for object type when operating on a file containing newlines

This typo would make "git cat-file cat-file" fail, and the way it's used,
I think it broke querying all info from filenames containing newlines,
because the other queries are only run when it succeeds.
This commit is contained in:
Joey Hess 2019-08-07 13:35:42 -04:00
parent ed6ed2e915
commit bf5dd723d3
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
2 changed files with 3 additions and 1 deletions

View file

@ -9,6 +9,8 @@ git-annex (7.20190731) UNRELEASED; urgency=medium
used for --in=. rather than the slow code path that unncessarily
queries the git-annex branch.
* Allow setting up a gcrypt special remote with encryption=shared.
* Fix querying git for object type when operating on a file containing
newlines.
-- Joey Hess <id@joeyh.name> Thu, 01 Aug 2019 00:11:56 -0400

View file

@ -182,7 +182,7 @@ querySize r repo = maybe Nothing (readMaybe . takeWhile (/= '\n'))
queryObjectType :: Ref -> Repo -> IO (Maybe ObjectType)
queryObjectType r repo = maybe Nothing (readObjectType . takeWhile (/= '\n'))
<$> querySingle (Param "cat-file") r repo hGetContentsStrict
<$> querySingle (Param "-t") r repo hGetContentsStrict
queryContent :: Ref -> Repo -> IO (Maybe L.ByteString)
queryContent r repo = fmap (\b -> L.fromChunks [b])