@@ -636,6 +636,7 @@ fn run_create_archive(args: StdioCommand) -> anyhow::Result<()> {
636636 writer,
637637 collected_items,
638638 & create_options,
639+ & filter,
639640 cli_option,
640641 password,
641642 args. solid ,
@@ -646,6 +647,7 @@ fn run_create_archive(args: StdioCommand) -> anyhow::Result<()> {
646647 io:: stdout ( ) . lock ( ) ,
647648 collected_items,
648649 & create_options,
650+ & filter,
649651 cli_option,
650652 password,
651653 args. solid ,
@@ -965,6 +967,7 @@ fn run_append(args: StdioCommand) -> anyhow::Result<()> {
965967 & mut archive,
966968 collected_items,
967969 & create_options,
970+ & filter,
968971 password,
969972 args. verbose ,
970973 ) ?;
@@ -982,6 +985,7 @@ fn run_append(args: StdioCommand) -> anyhow::Result<()> {
982985 & mut output_archive,
983986 collected_items,
984987 & create_options,
988+ & filter,
985989 password,
986990 args. verbose ,
987991 ) ?;
@@ -1019,6 +1023,7 @@ fn append_with_inclusions<W: Write>(
10191023 archive : & mut Archive < W > ,
10201024 collected_items : Vec < CollectedItem > ,
10211025 create_options : & CreateOptions ,
1026+ filter : & PathFilter < ' _ > ,
10221027 password : Option < & [ u8 ] > ,
10231028 verbose : bool ,
10241029) -> anyhow:: Result < ( ) > {
@@ -1033,7 +1038,7 @@ fn append_with_inclusions<W: Write>(
10331038 }
10341039 }
10351040 CollectedItem :: ArchiveMarker ( source) => {
1036- append_archive_entries ( archive, & source, password, verbose) ?;
1041+ append_archive_entries ( archive, & source, filter , password, verbose) ?;
10371042 }
10381043 }
10391044 }
@@ -1070,10 +1075,12 @@ fn resolve_name_id(
10701075/// Processes collected items in order, interleaving filesystem entries
10711076/// with entries from included archives. Order is preserved exactly as
10721077/// specified on the command line.
1078+ #[ allow( clippy:: too_many_arguments) ]
10731079fn create_archive_with_inclusions < W : Write > (
10741080 writer : W ,
10751081 collected_items : Vec < CollectedItem > ,
10761082 create_options : & CreateOptions ,
1083+ filter : & PathFilter < ' _ > ,
10771084 write_option : WriteOptions ,
10781085 password : Option < & [ u8 ] > ,
10791086 solid : bool ,
@@ -1084,6 +1091,7 @@ fn create_archive_with_inclusions<W: Write>(
10841091 writer,
10851092 collected_items,
10861093 create_options,
1094+ filter,
10871095 write_option,
10881096 password,
10891097 verbose,
@@ -1093,6 +1101,7 @@ fn create_archive_with_inclusions<W: Write>(
10931101 writer,
10941102 collected_items,
10951103 create_options,
1104+ filter,
10961105 password,
10971106 verbose,
10981107 )
@@ -1104,6 +1113,7 @@ fn create_normal_archive_with_inclusions<W: Write>(
11041113 writer : W ,
11051114 collected_items : Vec < CollectedItem > ,
11061115 create_options : & CreateOptions ,
1116+ filter : & PathFilter < ' _ > ,
11071117 password : Option < & [ u8 ] > ,
11081118 verbose : bool ,
11091119) -> anyhow:: Result < ( ) > {
@@ -1121,7 +1131,7 @@ fn create_normal_archive_with_inclusions<W: Write>(
11211131 }
11221132 }
11231133 CollectedItem :: ArchiveMarker ( source) => {
1124- append_archive_entries ( & mut archive, & source, password, verbose) ?;
1134+ append_archive_entries ( & mut archive, & source, filter , password, verbose) ?;
11251135 }
11261136 }
11271137 }
@@ -1135,6 +1145,7 @@ fn create_solid_archive_with_inclusions<W: Write>(
11351145 writer : W ,
11361146 collected_items : Vec < CollectedItem > ,
11371147 create_options : & CreateOptions ,
1148+ filter : & PathFilter < ' _ > ,
11381149 write_option : WriteOptions ,
11391150 password : Option < & [ u8 ] > ,
11401151 verbose : bool ,
@@ -1153,7 +1164,7 @@ fn create_solid_archive_with_inclusions<W: Write>(
11531164 }
11541165 }
11551166 CollectedItem :: ArchiveMarker ( source) => {
1156- append_archive_entries_to_solid ( & mut builder, & source, password, verbose) ?;
1167+ append_archive_entries_to_solid ( & mut builder, & source, filter , password, verbose) ?;
11571168 }
11581169 }
11591170 }
@@ -1170,16 +1181,21 @@ fn create_solid_archive_with_inclusions<W: Write>(
11701181fn append_archive_entries < W : Write > (
11711182 archive : & mut Archive < W > ,
11721183 source : & ArchiveSource ,
1173- _password : Option < & [ u8 ] > ,
1184+ filter : & PathFilter < ' _ > ,
1185+ password : Option < & [ u8 ] > ,
11741186 verbose : bool ,
11751187) -> anyhow:: Result < ( ) > {
11761188 let reader = source. open ( ) ?;
11771189 let mut src_archive = Archive :: read_header ( reader) ?;
11781190
1179- for entry in src_archive. raw_entries ( ) {
1191+ for entry in src_archive. entries_with_password ( password ) {
11801192 let entry = entry?;
1193+ let entry_path = entry. header ( ) . path ( ) ;
1194+ if filter. excluded ( entry_path) {
1195+ continue ;
1196+ }
11811197 if verbose {
1182- eprintln ! ( "a (from @{source})" ) ;
1198+ eprintln ! ( "a {} (from @{source})" , entry_path . as_path ( ) . display ( ) ) ;
11831199 }
11841200 archive. add_entry ( entry) ?;
11851201 }
@@ -1193,6 +1209,7 @@ fn append_archive_entries<W: Write>(
11931209fn append_archive_entries_to_solid (
11941210 builder : & mut SolidEntryBuilder ,
11951211 source : & ArchiveSource ,
1212+ filter : & PathFilter < ' _ > ,
11961213 password : Option < & [ u8 ] > ,
11971214 verbose : bool ,
11981215) -> anyhow:: Result < ( ) > {
@@ -1201,11 +1218,12 @@ fn append_archive_entries_to_solid(
12011218
12021219 for entry in src_archive. entries_with_password ( password) {
12031220 let entry = entry?;
1221+ let entry_path = entry. header ( ) . path ( ) ;
1222+ if filter. excluded ( entry_path) {
1223+ continue ;
1224+ }
12041225 if verbose {
1205- eprintln ! (
1206- "a {} (from @{source})" ,
1207- entry. header( ) . path( ) . as_path( ) . display( ) ,
1208- ) ;
1226+ eprintln ! ( "a {} (from @{source})" , entry_path. as_path( ) . display( ) ) ;
12091227 }
12101228
12111229 // Re-create entry for solid mode
0 commit comments