summaryrefslogtreecommitdiff
path: root/Git
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-02-14 00:22:42 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-02-14 00:22:42 -0400
commita2f241d50344726831ece2a354a599f389b20b54 (patch)
tree4201ae25224683439dc32437b7708eab3ab81a5b /Git
parentcbaebf538a8659193fb3dbb4f32e0f918a385af3 (diff)
fix LsFiles.typeChanged paths
Passing absolute paths to Command.Add used to work, but after recent changes doesn't. All LsFiles should use relative paths anyway, so fix it there.
Diffstat (limited to 'Git')
-rw-r--r--Git/LsFiles.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/Git/LsFiles.hs b/Git/LsFiles.hs
index 0de86383d..201d76d1d 100644
--- a/Git/LsFiles.hs
+++ b/Git/LsFiles.hs
@@ -65,7 +65,13 @@ typeChanged :: [FilePath] -> Repo -> IO [FilePath]
typeChanged = typeChanged' []
typeChanged' :: [CommandParam] -> [FilePath] -> Repo -> IO [FilePath]
-typeChanged' ps l = pipeNullSplit $ prefix ++ ps ++ suffix
+typeChanged' ps l repo = do
+ fs <- pipeNullSplit (prefix ++ ps ++ suffix) repo
+ -- git diff returns filenames relative to the top of the git repo;
+ -- convert to filenames relative to the cwd, like git ls-files.
+ let top = workTree repo
+ cwd <- getCurrentDirectory
+ return $ map (\f -> relPathDirToFile cwd $ top </> f) fs
where
prefix = [Params "diff --name-only --diff-filter=T -z"]
suffix = Param "--" : map File l