This wasn't caught by unit tests because "virtual" nodes added by
index.py:_golevel() weren't being marked as IX_EXISTS, which in the unit
tests included the root, so save-cmd was never actually trying to back up
that node.
That made the base directories incorrectly marked as status=D (deleted) if
you printed out the index during the tests. So add a test for that to make
it fail if "/" is deleted (which obviously makes no sense), then add another
test for saving from the root level, then fix both bugs.
shalists.append([])
def _pop(force_tree):
- assert(len(parts) > 1)
+ assert(len(parts) >= 1)
part = parts.pop()
shalist = shalists.pop()
tree = force_tree or w.new_tree(shalist)
- shalists[-1].append(('40000', part, tree))
+ if shalists:
+ shalists[-1].append(('40000', part, tree))
+ else: # this was the toplevel, so put it back for sanity
+ shalists.append(shalist)
return tree
lastremain = None
ent.validate(040000, newtree)
ent.repack()
count += ent.size
- continue
+ continue
+ # it's not a directory
id = None
if hashvalid:
mode = '%o' % ent.gitmode
assert(level)
while ename[:len(level.ename)] != level.ename:
n = BlankNewEntry(level.ename[-1])
+ n.flags |= IX_EXISTS
(n.children_ofs,n.children_n) = level.write(f)
level.parent.list.append(n)
level = level.parent
WVPASSEQ "$(cd $D && bup index -m)" ""
tree2=$(bup save -t $D)
WVPASSEQ "$tree1" "$tree2"
-
+WVPASSEQ "$(bup index -s / | grep ^D)" ""
+tree3=$(bup save -t /)
+WVPASSEQ "$tree1" "$tree3"
WVSTART "split"
WVPASS bup split --bench -b <t/testfile1 >tags1.tmp