# # patch "change_set.cc" # from [f45da9e6d6bc784324d6f606a12d21c34a6f306d] # to [8f5587b7d7efb5d40ee0f4a050a04adee219c8f7] # --- change_set.cc +++ change_set.cc @@ -520,42 +520,33 @@ I(ps.find(root_tid) == ps.end()); // Note that this find() also ensures // sortedness of ps. - tid min_tid = ps.begin()->first; - tid max_tid = ps.rbegin()->first; - size_t tid_range = max_tid - min_tid + 1; - - boost::dynamic_bitset<> confirmed(tid_range); - boost::dynamic_bitset<> ancs(tid_range); - - for (path_state::const_iterator i = ps.begin(); i != ps.end(); ++i) + // Test the following 3 things: + // - Sanity check on all path_state items + // - Verify that every parent of every node + // is part of the tree path_state too. + // - If path_state item has null_name, parent must + // have null_name too. + for(path_state::const_iterator i = ps.begin(); i != ps.end(); ++i) { - tid curr = i->first; - path_item item = i->second; - ancs.reset(); + path_item item = i->second; - while (confirmed.test(curr - min_tid) == false) - { - sanity_check_path_item(item); - I(ancs.test(curr - min_tid) == false); - ancs.set(curr - min_tid); - if (path_item_parent(item) == root_tid) - break; - else - { - curr = path_item_parent(item); - path_state::const_iterator j = ps.find(curr); - I(j != ps.end()); + sanity_check_path_item(item); + + tid parent = path_item_parent(item); + if (parent == root_tid) + continue; - // if we're null, our parent must also be null - if (null_name(item.name)) - I(null_name(path_state_item(j).name)); + path_state::const_iterator j = ps.find(parent); + I(j != ps.end()); - item = path_state_item(j); - I(path_item_type(item) == ptype_directory); - } - } - confirmed |= ancs; - } + path_item parent_item = path_state_item(j); + + if (null_name(item.name)) + I(null_name(parent_item.name)); + + I(path_item_type(parent_item) == ptype_directory); + } + } static void