@@ -45,17 +45,22 @@ pub struct ProcessorConfig {
4545 pub verbose : bool ,
4646}
4747
48+ #[ derive( Debug , Clone ) ]
49+ pub struct DiffRefsConfig < ' a > {
50+ pub timeout_secs : u64 ,
51+ pub extraction : & ' a ExtractionOptions ,
52+ pub no_security_tags : bool ,
53+ pub include_test_security : bool ,
54+ pub tag_definitions : & ' a [ SecurityTagDefinition ] ,
55+ pub verbose : bool ,
56+ }
57+
4858pub fn process_diff_refs (
4959 repo_path : & Path ,
5060 report_dir : & Path ,
5161 base_ref : & str ,
5262 head_ref : & str ,
53- timeout_secs : u64 ,
54- extraction : & ExtractionOptions ,
55- no_security_tags : bool ,
56- include_test_security : bool ,
57- tag_definitions : & [ SecurityTagDefinition ] ,
58- _verbose : bool ,
63+ config : & DiffRefsConfig ,
5964) -> RepoResult {
6065 let repo_name = repo_path
6166 . file_name ( )
@@ -66,7 +71,7 @@ pub fn process_diff_refs(
6671 let report_folder_name = repo_name. clone ( ) ;
6772 let mut errors = Vec :: new ( ) ;
6873
69- let base_commit = match capture_commit ( repo_path, timeout_secs, base_ref) {
74+ let base_commit = match capture_commit ( repo_path, config . timeout_secs , base_ref) {
7075 Ok ( c) => c,
7176 Err ( err) => {
7277 return RepoResult {
@@ -87,7 +92,7 @@ pub fn process_diff_refs(
8792 }
8893 } ;
8994
90- let head_commit = match capture_commit ( repo_path, timeout_secs, head_ref) {
95+ let head_commit = match capture_commit ( repo_path, config . timeout_secs , head_ref) {
9196 Ok ( c) => c,
9297 Err ( err) => {
9398 return RepoResult {
@@ -125,7 +130,7 @@ pub fn process_diff_refs(
125130 let mut diffs = Vec :: new ( ) ;
126131 let mut retrieval_cache = ShowFileCache :: new ( SHOW_FILE_CACHE_CAPACITY ) ;
127132
128- match generate_diff_artifacts ( repo_path, & diff_dir, timeout_secs, & pair) {
133+ match generate_diff_artifacts ( repo_path, & diff_dir, config . timeout_secs , & pair) {
129134 Ok ( artifacts) => {
130135 let patch_path = diff_dir. join ( & artifacts. patch_filename ) ;
131136 let patch_bytes = fs:: read ( & patch_path) . unwrap_or_default ( ) ;
@@ -145,27 +150,27 @@ pub fn process_diff_refs(
145150 & artifacts. name_status ,
146151 & base_commit. hash ,
147152 & head_commit. hash ,
148- extraction,
153+ config . extraction ,
149154 )
150155 } ) ) {
151156 Ok ( ( mut file_changes, element_summary) ) => {
152157 apply_git_show_diffonly_fallback (
153158 repo_path,
154- timeout_secs,
159+ config . timeout_secs ,
155160 & base_commit. hash ,
156161 & head_commit. hash ,
157162 & mut file_changes,
158163 & mut retrieval_cache,
159164 & mut errors,
160165 ) ;
161166
162- let security_review = if no_security_tags {
167+ let security_review = if config . no_security_tags {
163168 None
164169 } else {
165170 match tag_file_changes (
166171 & mut file_changes,
167- tag_definitions,
168- include_test_security,
172+ config . tag_definitions ,
173+ config . include_test_security ,
169174 ) {
170175 Ok ( review) => Some ( review) ,
171176 Err ( err) => {
@@ -560,20 +565,23 @@ pub fn process_repository<'a>(
560565 }
561566 }
562567
563- emit ( if errors. is_empty ( )
564- && !matches ! (
568+ emit (
569+ if errors. is_empty ( )
570+ && !matches ! (
571+ status,
572+ RepoStatus :: FetchFailed { .. } | RepoStatus :: PullFailed { .. }
573+ )
574+ {
575+ ProcessingState :: Complete
576+ } else if matches ! (
565577 status,
566578 RepoStatus :: FetchFailed { .. } | RepoStatus :: PullFailed { .. }
567579 ) {
568- ProcessingState :: Complete
569- } else if matches ! (
570- status,
571- RepoStatus :: FetchFailed { .. } | RepoStatus :: PullFailed { .. }
572- ) {
573- ProcessingState :: Failed
574- } else {
575- ProcessingState :: Complete
576- } ) ;
580+ ProcessingState :: Failed
581+ } else {
582+ ProcessingState :: Complete
583+ } ,
584+ ) ;
577585
578586 RepoResult {
579587 repo_path : repo_path. to_path_buf ( ) ,
0 commit comments