summaryrefslogtreecommitdiff
path: root/Git/LsFiles.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Git/LsFiles.hs')
-rw-r--r--Git/LsFiles.hs21
1 files changed, 15 insertions, 6 deletions
diff --git a/Git/LsFiles.hs b/Git/LsFiles.hs
index 82ce0edaf..f4e467215 100644
--- a/Git/LsFiles.hs
+++ b/Git/LsFiles.hs
@@ -12,6 +12,7 @@ module Git.LsFiles (
modified,
staged,
stagedNotDeleted,
+ stagedOthersDetails,
stagedDetails,
typeChanged,
typeChangedStaged,
@@ -69,16 +70,24 @@ staged' ps l = pipeNullSplit $ prefix ++ ps ++ suffix
prefix = [Params "diff --cached --name-only -z"]
suffix = Param "--" : map File l
-{- Returns details about files that are staged in the index
- - (including the Sha of their staged contents),
- - as well as files not yet in git. -}
+{- Returns details about files that are staged in the index,
+ - as well as files not yet in git. Skips ignored files. -}
+stagedOthersDetails :: [FilePath] -> Repo -> IO ([(FilePath, Maybe Sha)], IO Bool)
+stagedOthersDetails = stagedDetails' [Params "--others --exclude-standard"]
+
+{- Returns details about all files that are staged in the index. -}
stagedDetails :: [FilePath] -> Repo -> IO ([(FilePath, Maybe Sha)], IO Bool)
-stagedDetails l repo = do
+stagedDetails = stagedDetails' []
+
+{- Gets details about staged files, including the Sha of their staged
+ - contents. -}
+stagedDetails' :: [CommandParam] -> [FilePath] -> Repo -> IO ([(FilePath, Maybe Sha)], IO Bool)
+stagedDetails' ps l repo = do
(ls, cleanup) <- pipeNullSplit params repo
return (map parse ls, cleanup)
where
- params = [Params "ls-files --others --exclude-standard --stage -z --"] ++
- map File l
+ params = Params "ls-files --stage -z" : ps ++
+ Param "--" : map File l
parse s
| null file = (s, Nothing)
| otherwise = (file, extractSha $ take shaSize $ drop 7 metadata)