]> 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>
Sat, 25 Apr 2020 19:23:27 +0000 (14:23 -0500)
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>
(cherry picked from commit 47891d8951a95b8e0d9ca94387107cdf12ca3d3c)
Tested-by: Rob Browning <rlb@defaultvalue.org>
cmd/save-cmd.py

index e78796be48702c55d4b45d02bb0b31a53fe7f774..36cd43a009335f8a62f4cbb6998bda037fa66024 100755 (executable)
@@ -430,8 +430,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