From fcad57f5c8a5ff095d6e711035d622550312f4fe Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Mon, 15 Jun 2026 01:22:39 -0700 Subject: [PATCH 1/2] build: bump git-bot-feedback to v0.6.1 Moves some much needed logic downstream into git-bot-feedback: `FileFilter::walk_dir()` better supports absolute paths by stripping `repo_root` paths prefixed to the returned results. Also applied to a given relative `root_path`. Also removes a redundant patch to `get_changed_files()`. The results returned there are already relative to the repo root, so there's no need to strip a prefixed path that isn't there. follow-up to #349 --- Cargo.lock | 4 ++-- cpp-linter/Cargo.toml | 2 +- cpp-linter/src/git.rs | 2 -- cpp-linter/src/rest_client.rs | 12 ++---------- cpp-linter/src/run.rs | 13 +++---------- cpp-linter/tests/paginated_changed_files.rs | 1 - 6 files changed, 8 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 476c9026..4780717f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -732,9 +732,9 @@ dependencies = [ [[package]] name = "git-bot-feedback" -version = "0.5.6" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87c5dcb915266b670fbc0f47f7240cfe832a0e9363e7f509ef38dec960b80824" +checksum = "3fef7ddddaceca435d03bee13d2795201e9110b14db9610ba3846274904df41a" dependencies = [ "async-trait", "chrono", diff --git a/cpp-linter/Cargo.toml b/cpp-linter/Cargo.toml index 41c18957..dc6d7b6d 100644 --- a/cpp-linter/Cargo.toml +++ b/cpp-linter/Cargo.toml @@ -33,7 +33,7 @@ thiserror = { workspace = true } tokio = { workspace = true, features = ["macros", "rt-multi-thread"] } [dependencies.git-bot-feedback] -version = "0.5.6" +version = "0.6.1" features = ["file-changes"] # path = "../../git-bot-feedback" # git = "https://github.com/2bndy5/git-bot-feedback" diff --git a/cpp-linter/src/git.rs b/cpp-linter/src/git.rs index 393d54c2..2407a180 100644 --- a/cpp-linter/src/git.rs +++ b/cpp-linter/src/git.rs @@ -11,7 +11,6 @@ mod test { use std::{ env::{self, current_dir, set_current_dir}, fs, - path::PathBuf, process::Command, }; @@ -104,7 +103,6 @@ mod test { &LinesChangedOnly::Off.into(), &base_diff, ignore_staged, - &PathBuf::from("."), ) .await .unwrap() diff --git a/cpp-linter/src/rest_client.rs b/cpp-linter/src/rest_client.rs index ae3c3981..0c83d0eb 100644 --- a/cpp-linter/src/rest_client.rs +++ b/cpp-linter/src/rest_client.rs @@ -2,7 +2,7 @@ use std::{ env, - path::{Path, PathBuf}, + path::PathBuf, sync::{Arc, Mutex}, }; @@ -69,7 +69,6 @@ impl RestClient { lines_changed_only: &LinesChangedOnly, base_diff: &Option, ignore_index: bool, - repo_root: &Path, ) -> Result, ClientError> { let files = self .client @@ -89,14 +88,7 @@ impl RestClient { .map(|hunk| hunk.start..=hunk.end) .collect(); let file_path = PathBuf::from(file_name); - FileObj::from( - file_path - .strip_prefix(repo_root) - .map(PathBuf::from) - .unwrap_or(file_path), - diff_lines.added_lines.clone(), - diff_chunks, - ) + FileObj::from(file_path, diff_lines.added_lines.clone(), diff_chunks) }) .collect()) } diff --git a/cpp-linter/src/run.rs b/cpp-linter/src/run.rs index 59063aa4..ec2b29d9 100644 --- a/cpp-linter/src/run.rs +++ b/cpp-linter/src/run.rs @@ -82,7 +82,8 @@ pub async fn run_main(args: Vec) -> Result<()> { .collect::>(), None, ); - file_filter.parse_submodules(); + let gitmodules = cli.source_options.repo_root.join(".gitmodules"); + file_filter.parse_submodules(Some(gitmodules.as_path())); if let Some(files) = &cli.not_ignored { file_filter.not_ignored.extend(files.clone()); } @@ -101,7 +102,6 @@ pub async fn run_main(args: Vec) -> Result<()> { } rest_api_client.start_log_group("Get list of specified source files"); - let repo_root_path = PathBuf::from(&cli.source_options.repo_root); let files = if !matches!(cli.source_options.lines_changed_only, LinesChangedOnly::Off) || cli.source_options.files_changed_only { @@ -112,7 +112,6 @@ pub async fn run_main(args: Vec) -> Result<()> { &cli.source_options.lines_changed_only.clone().into(), &cli.source_options.diff_base, cli.source_options.ignore_index, - &repo_root_path, ) .await? } else { @@ -122,12 +121,7 @@ pub async fn run_main(args: Vec) -> Result<()> { .into_iter() .map(|file_name| { let file_path = PathBuf::from(&file_name); - FileObj::new( - file_path - .strip_prefix(&repo_root_path) - .map(PathBuf::from) - .unwrap_or(file_path), - ) + FileObj::new(file_path) }) .collect(); if is_pr && (cli.feedback_options.tidy_review || cli.feedback_options.format_review) { @@ -137,7 +131,6 @@ pub async fn run_main(args: Vec) -> Result<()> { &LinesChangedOnly::Off.into(), &cli.source_options.diff_base, cli.source_options.ignore_index, - &repo_root_path, ) .await?; for changed_file in changed_files { diff --git a/cpp-linter/tests/paginated_changed_files.rs b/cpp-linter/tests/paginated_changed_files.rs index 7563a10b..cf49ad25 100644 --- a/cpp-linter/tests/paginated_changed_files.rs +++ b/cpp-linter/tests/paginated_changed_files.rs @@ -143,7 +143,6 @@ async fn get_paginated_changes(lib_root: &Path, tmp_dir: &TempDir, test_params: &LinesChangedOnly::Off, &None::, false, - tmp_dir.path(), ) .await; match files { From 15f95e22d194320d39481f5ec4db9b51c30f434f Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Mon, 15 Jun 2026 02:50:08 -0700 Subject: [PATCH 2/2] fmt --- cpp-linter/tests/paginated_changed_files.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/cpp-linter/tests/paginated_changed_files.rs b/cpp-linter/tests/paginated_changed_files.rs index cf49ad25..dd2b3757 100644 --- a/cpp-linter/tests/paginated_changed_files.rs +++ b/cpp-linter/tests/paginated_changed_files.rs @@ -138,12 +138,7 @@ async fn get_paginated_changes(lib_root: &Path, tmp_dir: &TempDir, test_params: let file_filter = FileFilter::new(&[], &["cpp", "hpp"], None); let files = client - .get_list_of_changed_files( - &file_filter, - &LinesChangedOnly::Off, - &None::, - false, - ) + .get_list_of_changed_files(&file_filter, &LinesChangedOnly::Off, &None::, false) .await; match files { Err(e) => {