Fix reversion in 6.20161012 that prevented adding files with a space in their name.
authorJoey Hess <joeyh@joeyh.name>
Mon, 31 Oct 2016 22:35:38 +0000 (18:35 -0400)
committerJoey Hess <joeyh@joeyh.name>
Mon, 31 Oct 2016 22:39:37 +0000 (18:39 -0400)
CHANGELOG
Git/CatFile.hs
doc/bugs/git-annex_chokes_on_filenames_including_spaces.mdwn

index 2af02734884a33c29cdb36fec886bc56dc22e580..27bf556ec435e7f700bea72c3f675b15ba50c0df 100644 (file)
--- 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
 
index a377a08f770a1466acc6c86a0123f9fd23458db1..9af46fb51523458aa9aefa4281aabd80d227c424 100644 (file)
@@ -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)]
index 4415d65cda9e91db3b0c268dfa16fb037527e182..1412d6b3650bf7a70afb7fee0fc78a1128351e1e 100644 (file)
@@ -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]]