diff --git a/PKG-INFO b/PKG-INFO
index f8b20aaedfd784e7dc2a24b365b912437a026620..8c31421c3df7a762a2b4829800e0e19495521faf 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.0
 Name: swh.model
-Version: 0.0.6
+Version: 0.0.7
 Summary: Software Heritage data model
 Home-page: https://forge.softwareheritage.org/diffusion/DMOD/
 Author: Software Heritage developers
diff --git a/swh.model.egg-info/PKG-INFO b/swh.model.egg-info/PKG-INFO
index f8b20aaedfd784e7dc2a24b365b912437a026620..8c31421c3df7a762a2b4829800e0e19495521faf 100644
--- a/swh.model.egg-info/PKG-INFO
+++ b/swh.model.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.0
 Name: swh.model
-Version: 0.0.6
+Version: 0.0.7
 Summary: Software Heritage data model
 Home-page: https://forge.softwareheritage.org/diffusion/DMOD/
 Author: Software Heritage developers
diff --git a/swh/model/git.py b/swh/model/git.py
index 89586664fd619cf99ce435f369dbf0bcfb0f5897..f2c12c7a4ef61cd55d01a81109a048c4c64f8889 100644
--- a/swh/model/git.py
+++ b/swh/model/git.py
@@ -188,7 +188,8 @@ def compute_tree_metadata(dirname, ls_hashes):
 
 def walk_and_compute_sha1_from_directory(rootdir,
                                          dir_ok_fn=lambda dirpath: True,
-                                         with_root_tree=True):
+                                         with_root_tree=True,
+                                         remove_empty_folder=False):
     """Compute git sha1 from directory rootdir.
 
     Args:
@@ -232,6 +233,17 @@ def walk_and_compute_sha1_from_directory(rootdir,
                                                                   dirname)),
                            dirnames))
 
+    if remove_empty_folder:  # round-trip to remove empty folders
+        gen_dir = ((dp, filtfn(dp, dns), fns) for (dp, dns, fns)
+                   in os.walk(rootdir, topdown=False)
+                   if dir_ok_fn(dp))
+        for dirpath, dirnames, filenames in gen_dir:
+            if dirnames == [] and filenames == []:
+                if os.path.islink(dirpath):
+                    os.remove(dirpath)
+                else:
+                    os.removedirs(dirpath)
+
     gen_dir = ((dp, filtfn(dp, dns), fns) for (dp, dns, fns)
                in os.walk(rootdir, topdown=False)
                if dir_ok_fn(dp))
@@ -429,7 +441,8 @@ def __remove_paths_from_objects(objects, rootpaths,
 
 
 def update_checksums_from(changed_paths, objects,
-                          dir_ok_fn=lambda dirpath: True):
+                          dir_ok_fn=lambda dirpath: True,
+                          remove_empty_folder=False):
     """Given a list of changed paths, recompute the checksums only where
     needed.
 
@@ -459,7 +472,10 @@ def update_checksums_from(changed_paths, objects,
 
         parent = os.path.dirname(path)
         if parent == root:  # ... recompute everything anyway
-            return walk_and_compute_sha1_from_directory(root, dir_ok_fn)
+            return walk_and_compute_sha1_from_directory(
+                root,
+                dir_ok_fn=dir_ok_fn,
+                remove_empty_folder=remove_empty_folder)
 
         if changed_path['action'] == 'D':  # (D)elete
             paths_to_remove.add(path)
@@ -480,15 +496,24 @@ def update_checksums_from(changed_paths, objects,
 
     # Recompute from disk the checksums from impacted common ancestor
     # rootdir changes.
-    if not objects.get(rootdir, None):
-        # rootdir no longer exists, recompute all
-        # folder could have been previously ignored
-        # (e.g. in svn case with ignore flag activated)
-        return walk_and_compute_sha1_from_directory(root,
-                                                    dir_ok_fn)
-
-    hashes = walk_and_compute_sha1_from_directory(rootdir, dir_ok_fn,
-                                                  with_root_tree=False)
+    while not objects.get(rootdir, None):
+        # it could happened that the path is not found.
+        # In the case of an ignored folder for example.
+        # So we'll find the next existing parent
+        rootdir = os.path.dirname(rootdir)
+
+        if rootdir == root:     # fallback, if we hit root, walk
+                                # everything anyway
+            return walk_and_compute_sha1_from_directory(
+                root,
+                dir_ok_fn=dir_ok_fn,
+                remove_empty_folder=remove_empty_folder)
+
+    hashes = walk_and_compute_sha1_from_directory(
+        rootdir,
+        dir_ok_fn=dir_ok_fn,
+        with_root_tree=False,
+        remove_empty_folder=remove_empty_folder)
 
     # Then update the original objects with new
     # checksums for the arborescence tree below rootdir
diff --git a/swh/model/tests/test_git.py b/swh/model/tests/test_git.py
index 4b94496370127911d310a4ab635354079eccf3c2..fd8f8d1174dadc9e8acc6f77b1696fb94e512792 100644
--- a/swh/model/tests/test_git.py
+++ b/swh/model/tests/test_git.py
@@ -146,6 +146,7 @@ class GitHashWalkArborescenceTree(unittest.TestCase):
     """
     def setUp(self):
         self.tmp_root_path = tempfile.mkdtemp().encode('utf-8')
+        self.maxDiff = None
 
         start_path = os.path.dirname(__file__).encode('utf-8')
         pkg_doc_linux_r11 = os.path.join(start_path,
diff --git a/version.txt b/version.txt
index 7f521e56f9e993ffa483419e7c7f02c0552fcc46..4c662145c377c8a08c60f2c36e8eb83d05d85b9b 100644
--- a/version.txt
+++ b/version.txt
@@ -1 +1 @@
-v0.0.6-0-gca235a0
\ No newline at end of file
+v0.0.7-0-g22b9fca
\ No newline at end of file