Skip to content

Commit

Permalink
Move skipping exclusion before inserting remote_list
Browse files Browse the repository at this point in the history
  • Loading branch information
taoky committed Jan 26, 2024
1 parent e98ee1f commit eb9bd43
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/cli/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,17 @@ fn download_handler(
"expected_path: {:?}, relative: {:?}",
expected_path, relative_filepath
);

// We should put relative filepath into exclusion manager here
if task_context.exclusion_manager.match_str(&relative_filepath)
== regex_process::Comparison::Stop
{
// This should be run before inserting remote_list.
// Otherwise newly excluded files will not be deleted later.
info!("Skipping excluded {:?}", &relative_filepath);
return;
}

{
if !thr_context
.remote_list
Expand All @@ -353,20 +364,12 @@ fn download_handler(
{
// It is possible that multiple tasks might download the same file
// (generated by apt/yum parser, etc.)
// skip when we find that some thread has already downloaded it
// skip when we find that some threads has already downloaded it
info!("Skipping already handled {:?}", &expected_path);
return;
}
}

// We should put relative filepath into exclusion manager here
if task_context.exclusion_manager.match_str(&relative_filepath)
== regex_process::Comparison::Stop
{
info!("Skipping excluded {:?}", &relative_filepath);
return;
}

let mut should_download = true;
let mut skip_if_exists = false;
for i in &args.skip_if_exists {
Expand Down

0 comments on commit eb9bd43

Please sign in to comment.