summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-10-31 18:35:38 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-10-31 18:39:37 -0400
commit8d607c894f8bfae17f6e4f5df81ce1c7decf9fa9 (patch)
tree370e9485fd50f2c187ca35e7fadb1afee65d0d0a
parentf6773a28f870e441a7cdad66ce586008a6eff32e (diff)
Fix reversion in 6.20161012 that prevented adding files with a space in their name.
-rw-r--r--CHANGELOG2
-rw-r--r--Git/CatFile.hs23
-rw-r--r--doc/bugs/git-annex_chokes_on_filenames_including_spaces.mdwn3
3 files changed, 17 insertions, 11 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 2af027348..27bf556ec 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -3,6 +3,8 @@ git-annex (6.20161028) UNRELEASED; urgency=medium
* Assistant, repair: Fix ignoring of git fsck errors due to
duplicate file entries in tree objects.
* Linux standalone: Fix location of locale files in the bundle.
+ * Fix reversion in 6.20161012 that prevented adding files with a space
+ in their name.
-- Joey Hess <id@joeyh.name> Mon, 31 Oct 2016 13:59:47 -0400
diff --git a/Git/CatFile.hs b/Git/CatFile.hs
index a377a08f7..9af46fb51 100644
--- a/Git/CatFile.hs
+++ b/Git/CatFile.hs
@@ -109,17 +109,18 @@ query hdl object receive = CoProcess.query hdl send receive
send to = hPutStrLn to (fromRef object)
parseResp :: Ref -> String -> Maybe ParsedResp
-parseResp object l = case words l of
- [sha, objtype, size]
- | length sha == shaSize ->
- case (readObjectType objtype, reads size) of
- (Just t, [(bytes, "")]) ->
- Just $ ParsedResp (Ref sha) bytes t
- _ -> Nothing
- | otherwise -> Nothing
- _
- | l == fromRef object ++ " missing" -> Just DNE
- | otherwise -> Nothing
+parseResp object l
+ | " missing" `isSuffixOf` l -- less expensive than full check
+ && l == fromRef object ++ " missing" = Just DNE
+ | otherwise = case words l of
+ [sha, objtype, size]
+ | length sha == shaSize ->
+ case (readObjectType objtype, reads size) of
+ (Just t, [(bytes, "")]) ->
+ Just $ ParsedResp (Ref sha) bytes t
+ _ -> Nothing
+ | otherwise -> Nothing
+ _ -> Nothing
{- Gets a list of files and directories in a tree. (Not recursive.) -}
catTree :: CatFileHandle -> Ref -> IO [(FilePath, FileMode)]
diff --git a/doc/bugs/git-annex_chokes_on_filenames_including_spaces.mdwn b/doc/bugs/git-annex_chokes_on_filenames_including_spaces.mdwn
index 4415d65cd..1412d6b36 100644
--- a/doc/bugs/git-annex_chokes_on_filenames_including_spaces.mdwn
+++ b/doc/bugs/git-annex_chokes_on_filenames_including_spaces.mdwn
@@ -24,3 +24,6 @@ add foo bar git-annex: unknown response from git cat-file ("HEAD:./foo bar missi
CallStack (from HasCallStack):
error, called at ./Git/CatFile.hs:102:28 in main:Git.CatFile
"""]]
+
+> What an embarrasing reversion. [[fixed|done]] and I'll push a release for
+> it right away. --[[Joey]]