# # # patch "automate.cc" # from [d083b203936a4d0abcd55e2ae9e3479192db220c] # to [1a9d6ebed98581b1499fe2594c906fe20a333c42] # ============================================================ --- automate.cc d083b203936a4d0abcd55e2ae9e3479192db220c +++ automate.cc 1a9d6ebed98581b1499fe2594c906fe20a333c42 @@ -546,7 +546,8 @@ inventory_rosters(roster_t const & old_r static void inventory_rosters(roster_t const & old_roster, roster_t const & new_roster, - node_restriction const & mask, + node_restriction const & nmask, + path_restriction const & pmask, inventory_map & inventory) { std::map old_paths; @@ -555,24 +556,30 @@ inventory_rosters(roster_t const & old_r node_map const & old_nodes = old_roster.all_nodes(); for (node_map::const_iterator i = old_nodes.begin(); i != old_nodes.end(); ++i) { - if (mask.includes(old_roster, i->first)) + if (nmask.includes(old_roster, i->first)) { file_path fp; old_roster.get_name(i->first, fp); - get_node_info(old_roster.get_node(i->first), inventory[fp].old_node); - old_paths[inventory[fp].old_node.id] = fp; + if (pmask.includes(fp)) + { + get_node_info(old_roster.get_node(i->first), inventory[fp].old_node); + old_paths[inventory[fp].old_node.id] = fp; + } } } node_map const & new_nodes = new_roster.all_nodes(); for (node_map::const_iterator i = new_nodes.begin(); i != new_nodes.end(); ++i) { - if (mask.includes(new_roster, i->first)) + if (nmask.includes(new_roster, i->first)) { file_path fp; new_roster.get_name(i->first, fp); - get_node_info(new_roster.get_node(i->first), inventory[fp].new_node); - new_paths[inventory[fp].new_node.id] = fp; + if (pmask.includes(fp)) + { + get_node_info(new_roster.get_node(i->first), inventory[fp].new_node); + new_paths[inventory[fp].new_node.id] = fp; + } } } @@ -584,10 +591,10 @@ inventory_rosters(roster_t const & old_r // There is no new node available; this is either a drop or a // rename to outside the current path restriction. - if (new_roster.has_node (i->first)) + if (new_roster.has_node(i->first)) { // record rename to outside restriction - new_roster.get_name (i->first, inventory[i->second].new_path); + new_roster.get_name(i->first, inventory[i->second].new_path); continue; } else @@ -617,10 +624,10 @@ inventory_rosters(roster_t const & old_r // There is no old node available; this is either added or a // rename from outside the current path restriction. - if (old_roster.has_node (i->first)) + if (old_roster.has_node(i->first)) { // record rename from outside restriction - old_roster.get_name (i->first, inventory[i->second].old_path); + old_roster.get_name(i->first, inventory[i->second].old_path); } else // added; no old path @@ -899,12 +906,12 @@ CMD_AUTOMATE(inventory, N_("[PATH]...") vector excludes = args_to_paths(app.opts.exclude_patterns); node_restriction nmask(includes, excludes, app.opts.depth, old_roster, new_roster, app); - inventory_rosters(old_roster, new_roster, nmask, inventory); - // skip the check of the workspace paths because some of them might // be missing and the user might want to query the recorded structure // of them anyways path_restriction pmask(includes, excludes, app.opts.depth, app, path_restriction::skip_check); + + inventory_rosters(old_roster, new_roster, nmask, pmask, inventory); inventory_filesystem(pmask, inventory, app); basic_io::printer pr;