]> arthur.barton.de Git - bup.git/commitdiff
save: remove pointless metalist check
authorJohannes Berg <johannes@sipsolutions.net>
Tue, 28 Jan 2020 19:41:10 +0000 (20:41 +0100)
committerRob Browning <rlb@defaultvalue.org>
Mon, 24 Feb 2020 01:43:49 +0000 (19:43 -0600)
The metalist can never be empty, since at every level we add
at least the directory's own metadata; it may not have actual
metadata, but there's an entry all the time.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
cmd/save-cmd.py

index e0b1e4715257098bb307004fbcf4222f6c7886ee..a6190b0a09623a6654d7e860b3a8405f5df33066 100755 (executable)
@@ -177,16 +177,16 @@ def _pop(force_tree, dir_metadata=None):
                 if not stat.S_ISDIR(x[0]):
                     metaidx += 1
 
-        if metalist:
-            if dir_metadata: # Override the original metadata pushed for this dir.
-                metalist = [(b'', dir_metadata)] + metalist[1:]
-            sorted_metalist = sorted(metalist, key = lambda x : x[0])
-            metadata = b''.join([m[1].encode() for m in sorted_metalist])
-            metadata_f = BytesIO(metadata)
-            mode, id = hashsplit.split_to_blob_or_tree(w.new_blob, w.new_tree,
-                                                       [metadata_f],
-                                                       keep_boundaries=False)
-            clean_list.append((mode, b'.bupm', id))
+        if dir_metadata: # Override the original metadata pushed for this dir.
+            metalist = [(b'', dir_metadata)] + metalist[1:]
+        sorted_metalist = sorted(metalist, key = lambda x : x[0])
+        metadata = b''.join([m[1].encode() for m in sorted_metalist])
+        metadata_f = BytesIO(metadata)
+        mode, id = hashsplit.split_to_blob_or_tree(w.new_blob, w.new_tree,
+                                                   [metadata_f],
+                                                   keep_boundaries=False)
+        clean_list.append((mode, b'.bupm', id))
+
         tree = w.new_tree(clean_list)
     if shalists:
         shalists[-1].append((GIT_MODE_TREE,