diff --git a/vibi-dpu/src/utils/gitops.rs b/vibi-dpu/src/utils/gitops.rs index 6bde3d64..6f33b2eb 100644 --- a/vibi-dpu/src/utils/gitops.rs +++ b/vibi-dpu/src/utils/gitops.rs @@ -151,21 +151,22 @@ pub fn get_excluded_files(review: &Review) -> Option<(Vec, Vec Option<(Vec, Vec)>{ let statvec = process_statitems(statstr); - let mut bigfiles = Vec::::new(); - let mut smallfiles = Vec::::new(); + let mut excluded_files = Vec::::new(); + let mut filtered_files = Vec::::new(); let line_threshold = 500; for item in statvec { // logic for exclusion if (item.additions > line_threshold) || (item.deletions > line_threshold) || - (item.additions + item.deletions > line_threshold) { - bigfiles.push(item); + (item.additions + item.deletions > line_threshold) || + (item.deletions < 1) { + excluded_files.push(item); } else { - smallfiles.push(item); + filtered_files.push(item); } } - return Some((bigfiles, smallfiles)); + return Some((excluded_files, filtered_files)); } fn generate_statitem(statitems: &Vec<&str>) -> StatItem { @@ -253,7 +254,9 @@ fn process_diff(filepath: &str, diff: &str, linemap: &mut HashMap bool { + // Split the hunk into lines + let lines = hunk.split('\n').collect::>(); + + // Iterate through the lines to check for deletions + for line in lines.iter() { + if line.starts_with('-') && !line.starts_with("---") { + return true; + } + } + + return false; +} + pub fn process_diffmap(diffmap: &HashMap) -> HashMap> { let mut linemap: HashMap> = HashMap::new(); for (filepath, diff) in diffmap {