summaryrefslogtreecommitdiff
path: root/Branch.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-06-22 23:24:14 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-06-22 23:24:14 -0400
commitaad73c5721490a5679820ab9c16a8b462fa0e0f2 (patch)
tree3156a0debf9a707f4e928811b0aa151d2c4d0e13 /Branch.hs
parent68783fd5e0e23ce698f2c2c2e2bd28c54cadf9c5 (diff)
rewrite loggedkeys to use git-annex branch
That sucking sound is a whole page of code vanishing to be replaced with return . catMaybes . map (logFileKey . takeFileName) =<< Branch.files What can I say, git is my database, and haskell my copilot.
Diffstat (limited to 'Branch.hs')
-rw-r--r--Branch.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/Branch.hs b/Branch.hs
index 4f204929e..a43ee227b 100644
--- a/Branch.hs
+++ b/Branch.hs
@@ -11,7 +11,7 @@ module Branch (
get,
change,
commit,
- shortref
+ files
) where
import Control.Monad (unless, when, liftM)
@@ -222,3 +222,10 @@ cmdOutput cmd params = do
let rv = seq retval retval
_ <- getProcessStatus True False pid
return rv
+
+{- Lists all files on the branch. -}
+files :: Annex [FilePath]
+files = withIndexUpdate $ do
+ g <- Annex.gitRepo
+ liftIO $ Git.pipeNullSplit g
+ [Params "ls-tree --name-only -r -z", Param fullname]