From ccfdaa6bd0f32321951c6f4058569f318afbe4ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Henry?= Date: Sat, 4 Mar 2017 21:52:05 +0100 Subject: [PATCH] FunView: fix recursive removal. --- src/node/db/ir_funview.ml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/node/db/ir_funview.ml b/src/node/db/ir_funview.ml index 7b08ebee8..2f9c24530 100644 --- a/src/node/db/ir_funview.ml +++ b/src/node/db/ir_funview.ml @@ -577,8 +577,18 @@ module Make (S: Irmin.S) = struct | None -> Lwt.return_none | Some n -> match Node.read_succ n h with - | None -> Lwt.return_none - | Some child -> aux child p + | None -> + 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 aux n k >>= function | None -> Lwt.return t