summaryrefslogtreecommitdiff
path: root/Git/LsFiles.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-07-28 15:27:36 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-07-28 16:55:42 -0400
commit217068206893864ed05911c3b06d8fdb802750a1 (patch)
tree3bfa87ee63197405f3aa18138eb8affd3ce7c7e7 /Git/LsFiles.hs
parent468e2c789371f924ec4586148e4e9e5618c58303 (diff)
importfeed: git-annex becomes a podcatcher in 150 LOC
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)