Once we enter the subtree, all of the parents must be on the stack for
subsequent operations to work correctly (like the _pop() in the
following "if not file:" section).
Consider the case where /some/empty/dir was indexed, but removed before
save. Without this fix, the metadata read for "dir" would fail and the
pending directory stack (parts) would include /some/empty instead of
/some/empty/dir.
Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
except (OSError, IOError), e:
add_error(e)
lastskip_name = dir_name
- else:
- _push(dir_name, meta)
+ meta = metadata.Metadata()
+ _push(dir_name, meta)
if not file:
if len(parts) == 1:
# with directories, bup notices that foo is missing, so it fails
# (complete with delayed error)
WVFAIL bup save -n save-fail-missing "$D"
-# ... so "foo" is absent from "bup ls"
+# ...but foo is still saved since it was just fine in the index
WVPASSEQ "$(bup ls -AF save-fail-missing/latest/$TOP/$D/)" "bar/
-baz/"
+baz/
+foo/"
# Index again:
WVPASS bup tick
WVPASS bup index -ux "$D"
# no non-zero-exitcode anymore:
WVPASS bup save -n save-fail-missing "$D"
-# foo is (still...) missing, of course:
+# foo is now gone
WVPASSEQ "$(bup ls -AF save-fail-missing/latest/$TOP/$D/)" "bar/
baz/"