diff options
-rw-r--r-- | Git.hs | 13 | ||||
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | doc/bugs/__39__annex_add__39___fails_to___39__git_add__39___for_parent_relative_path.mdwn | 2 | ||||
-rw-r--r-- | test.hs | 10 |
4 files changed, 20 insertions, 6 deletions
@@ -530,6 +530,7 @@ checkAttr repo attr files = do -- directory. Convert to absolute, and then convert the filenames -- in its output back to relative. cwd <- getCurrentDirectory + let top = workTree repo let absfiles = map (absPathFrom cwd) files (_, fromh, toh) <- hPipeBoth "git" (toCommand params) _ <- forkProcess $ do @@ -539,19 +540,21 @@ checkAttr repo attr files = do exitSuccess hClose toh s <- hGetContents fromh - return $ map (topair $ cwd++"/") $ lines s + return $ map (topair cwd top) $ lines s where params = gitCommandLine repo [Param "check-attr", Param attr, Params "-z --stdin"] - topair cwd l = (relfile, value) + topair cwd top l = (relfile, value) where - relfile - | startswith cwd file = drop (length cwd) file - | otherwise = file + relfile + | startswith cwd' file = drop (length cwd') file + | otherwise = relPathDirToFile top' file file = decodeGitFile $ join sep $ take end bits value = bits !! end end = length bits - 1 bits = split sep l sep = ": " ++ attr ++ ": " + cwd' = cwd ++ "/" + top' = top ++ "/" {- Some git commands output encoded filenames. Decode that (annoyingly - complex) encoding. -} diff --git a/debian/changelog b/debian/changelog index 80fe84256..ec3176d12 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ git-annex (3.20110708) UNRELEASED; urgency=low * add: Be even more robust to avoid ever leaving the file seemingly deleted. + * Bugfix: Make add ../ work. -- Joey Hess <joeyh@debian.org> Thu, 07 Jul 2011 21:28:49 -0400 diff --git a/doc/bugs/__39__annex_add__39___fails_to___39__git_add__39___for_parent_relative_path.mdwn b/doc/bugs/__39__annex_add__39___fails_to___39__git_add__39___for_parent_relative_path.mdwn index 1243bbfb2..f129abf62 100644 --- a/doc/bugs/__39__annex_add__39___fails_to___39__git_add__39___for_parent_relative_path.mdwn +++ b/doc/bugs/__39__annex_add__39___fails_to___39__git_add__39___for_parent_relative_path.mdwn @@ -11,3 +11,5 @@ error: Invalid path '.git/annex/objects/Jx/... ... Then it seems it is enough to 'git add ../d/f' to complete the operation. + +> Thanks for reporting, [[fixed|done]] --[[Joey]] @@ -108,7 +108,7 @@ test_init = "git-annex init" ~: TestCase $ innewrepo $ do reponame = "test repo" test_add :: Test -test_add = "git-annex add" ~: TestList [basic, sha1dup] +test_add = "git-annex add" ~: TestList [basic, sha1dup, subdirs] where -- this test case runs in the main repo, to set up a basic -- annexed file that later tests will use @@ -129,6 +129,14 @@ test_add = "git-annex add" ~: TestList [basic, sha1dup] git_annex "add" ["-q", sha1annexedfiledup, "--backend=SHA1"] @? "add of second file with same SHA1 failed" annexed_present sha1annexedfiledup annexed_present sha1annexedfile + subdirs = TestCase $ intmpclonerepo $ do + createDirectory "dir" + writeFile "dir/foo" $ content annexedfile + git_annex "add" ["-q", "dir"] @? "add of subdir failed" + createDirectory "dir2" + writeFile "dir2/foo" $ content annexedfile + changeWorkingDirectory "dir" + git_annex "add" ["-q", "../dir2"] @? "add of ../subdir failed" test_setkey :: Test test_setkey = "git-annex setkey/fromkey" ~: TestCase $ inmainrepo $ do |