Skip to content

Commit c5e14d0

Browse files
committed
[gitlib-cmdline] change cliSourceTreeEntries to take a recursive::Bool argument; make the inclusion of the "-r" flag dependent on this argument
1 parent fe2efa6 commit c5e14d0

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

gitlib-cmdline/Git/CmdLine.hs

+9-3
Original file line numberDiff line numberDiff line change
@@ -495,16 +495,22 @@ cliTreeEntry tree fp = do
495495
((_,x):_) -> Just x
496496

497497
cliSourceTreeEntries :: MonadCli m
498-
=> Tree CliRepo
498+
=> Bool
499+
-> Tree CliRepo
499500
-> ConduitT i (TreeFilePath, TreeEntry CliRepo) (ReaderT CliRepo m ())
500-
cliSourceTreeEntries tree = do
501+
cliSourceTreeEntries recursive tree = do
501502
contents <- lift $ do
502503
toid <- treeOid tree
503-
runGit [ "ls-tree", "-t", "-r", "-z"
504+
runGit $ "ls-tree"
505+
: "-t"
506+
: consIf recursive "-r"
507+
[ "-z"
504508
, fromStrict (renderObjOid toid)
505509
]
506510
forM_ (L.init (TL.splitOn "\NUL" contents)) $
507511
yield <=< lift . cliParseLsTree
512+
where
513+
consIf b x xs = if b then x:xs else xs
508514

509515
cliLookupCommit :: MonadCli m
510516
=> CommitOid CliRepo -> ReaderT CliRepo m (Commit CliRepo)

0 commit comments

Comments
 (0)