FunView: fix recursive removal.

This commit is contained in:
Grégoire Henry 2017-03-04 21:52:05 +01:00
parent 534dc6af9d
commit ccfdaa6bd0

View File

@ -577,8 +577,18 @@ module Make (S: Irmin.S) = struct
| None -> Lwt.return_none | None -> Lwt.return_none
| Some n -> | Some n ->
match Node.read_succ n h with match Node.read_succ n h with
| None -> Lwt.return_none | None ->
| Some child -> aux child p Lwt.return_none
| Some child ->
aux child p >>= function
| None -> Lwt.return_none
| Some child -> begin
(* remove empty dirs *)
Node.is_empty child >>= function
| true -> Lwt.return_none
| false -> Lwt.return (Some child)
end >>= fun child ->
Node.with_succ view h child
in in
aux n k >>= function aux n k >>= function
| None -> Lwt.return t | None -> Lwt.return t