aboutsummaryrefslogtreecommitdiffstats
path: root/src/Store
diff options
context:
space:
mode:
Diffstat (limited to 'src/Store')
-rw-r--r--src/Store/Store.hs20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Store/Store.hs b/src/Store/Store.hs
index b58a2da..e0bbdfb 100644
--- a/src/Store/Store.hs
+++ b/src/Store/Store.hs
@@ -3,6 +3,7 @@ module Store.Store
withStore,
withCommit,
listFiles,
+ listAllFiles,
readFile,
writeFile,
deleteFile,
@@ -116,6 +117,25 @@ listFiles :: FilePath -> StoreM [FilePath]
listFiles =
fmap (filter (not . (isSuffixOf "/"))) . listDirectory
+listAllFiles :: StoreM [FilePath]
+listAllFiles = do
+ State {tid} <- get
+ Env {repo} <- ask
+ lift $ G.runRepository GB.lgFactory repo $ do
+ tree <- G.lookupTree tid
+ filter (not . isSuffixOf "/")
+ . sort
+ . map fst
+ . map
+ ( \e ->
+ case snd e of
+ G.BlobEntry _ _ -> e
+ G.CommitEntry _ -> error "XXX commit entry"
+ G.TreeEntry _ -> first addTrailingPathSeparator e
+ )
+ . map (first (("/" <>) . B.toString))
+ <$> G.listTreeEntries tree
+
data DoesNotExist = DoesNotExist String FilePath
deriving (Show)