summaryrefslogtreecommitdiff
path: root/Git
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-12-24 14:24:13 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-12-24 14:24:13 -0400
commite0b543af10599f0fe382b39955e89101534d7bcb (patch)
tree5e1469dfad0ad3eeee8e3122143667ca334d30d3 /Git
parent8f4a33ece3651a1bdd1c4073bc0e1dcb86fa6315 (diff)
make startup scan for deleted files work in direct mode
git add --update cannot be used, because it'll stage typechanged direct mode files. Intead, use ls-files to find deleted files, and stage them ourselves. It seems that no commit was made before when the scan staged deleted files. (Probably masked since if files were added, a commit happened then..) Now that I'm doing the staging, I was also able to fix that bug.
Diffstat (limited to 'Git')
-rw-r--r--Git/LsFiles.hs16
1 files changed, 12 insertions, 4 deletions
diff --git a/Git/LsFiles.hs b/Git/LsFiles.hs
index 45c830cd6..401ed5562 100644
--- a/Git/LsFiles.hs
+++ b/Git/LsFiles.hs
@@ -8,6 +8,7 @@
module Git.LsFiles (
inRepo,
notInRepo,
+ deleted,
staged,
stagedNotDeleted,
stagedDetails,
@@ -38,6 +39,13 @@ notInRepo include_ignored l repo = pipeNullSplit params repo
| include_ignored = []
| otherwise = [Param "--exclude-standard"]
+{- Returns a list of files in the specified locations that have been
+ - deleted. -}
+deleted :: [FilePath] -> Repo -> IO ([FilePath], IO Bool)
+deleted l repo = pipeNullSplit params repo
+ where
+ params = [Params "ls-files --deleted -z --"] ++ map File l
+
{- Returns a list of all files that are staged for commit. -}
staged :: [FilePath] -> Repo -> IO ([FilePath], IO Bool)
staged = staged' []
@@ -112,7 +120,7 @@ data Unmerged = Unmerged
- 1 = old version, can be ignored
- 2 = us
- 3 = them
- - If a line is omitted, that side deleted the file.
+ - If a line is omitted, that side removed the file.
-}
unmerged :: [FilePath] -> Repo -> IO ([Unmerged], IO Bool)
unmerged l repo = do
@@ -157,11 +165,11 @@ reduceUnmerged c (i:is) = reduceUnmerged (new:c) rest
, unmergedBlobType = Conflicting blobtypeA blobtypeB
, unmergedSha = Conflicting shaA shaB
}
- findsib templatei [] = ([], deleted templatei)
+ findsib templatei [] = ([], removed templatei)
findsib templatei (l:ls)
| ifile l == ifile templatei = (ls, l)
- | otherwise = (l:ls, deleted templatei)
- deleted templatei = templatei
+ | otherwise = (l:ls, removed templatei)
+ removed templatei = templatei
{ isus = not (isus templatei)
, iblobtype = Nothing
, isha = Nothing