]> arthur.barton.de Git - bup.git/commitdiff
save: add empty metadata if reading fails
authorJohannes Berg <johannes@sipsolutions.net>
Sat, 25 Jan 2020 21:18:53 +0000 (22:18 +0100)
committerRob Browning <rlb@defaultvalue.org>
Sun, 23 Feb 2020 20:24:47 +0000 (14:24 -0600)
If we cannot read a file's metadata, we must add an entry in the
repository nonetheless because the bupm contents must match the
tree contents.

Add a dummy (empty) metadata entry in this case, as is already
done when reading a directory's metadata.

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

index 28019ba7f18716637c467c6d9dd9cdfab4aa15a1..76c1c8fec89360de5a645209bb8ba7f050b835d5 100755 (executable)
@@ -442,8 +442,8 @@ for (transname,ent) in r.filter(extra, wantrecurse=wantrecurse_during):
             except (OSError, IOError) as e:
                 add_error(e)
                 lastskip_name = ent.name
-            else:
-                metalists[-1].append((sort_key, meta))
+                meta = metadata.Metadata()
+            metalists[-1].append((sort_key, meta))
 
     if exists and wasmissing:
         count += oldsize