mirror of
https://github.com/openai/codex.git
synced 2026-11-15 21:50:46 +00:00
Skip submodule worktree scans when checking repository changes (#60669)
## Why Submodule worktree scans can execute clean filters selected by task-writable Git configuration. ## What changed Pass `--ignore-submodules=dirty` to `git status` in `get_has_changes_in_repo` to skip uncommitted submodule contents while retaining gitlink changes. ## Testing Add a regression test that configures a submodule clean filter and verifies the repository change check does not execute it. The test also confirms that `git status` without the option executes the filter. GitOrigin-RevId: 5330402f0354c3bf9613358575f8bedc9f312886
This commit is contained in:
committed by
copyberry
parent
733a1cca06
commit
39f422522e
@@ -26,15 +26,22 @@ fn git_status_runs() -> &'static Mutex<HashMap<GitStatusKey, WeakShared<GitStatu
|
||||
RUNS.get_or_init(|| Mutex::new(HashMap::new()))
|
||||
}
|
||||
|
||||
/// Reports repository changes without inspecting uncommitted submodule contents.
|
||||
pub async fn get_has_changes_in_repo(cwd: &Path, repo_root: &Path) -> Option<bool> {
|
||||
let git = PathBuf::from("git");
|
||||
let cwd = cwd.to_path_buf();
|
||||
let key = git_status_key(git.clone(), repo_root).await;
|
||||
share_git_status_run(key, move || async move {
|
||||
let fsmonitor = detect_local_fsmonitor_override(&git, &cwd).await;
|
||||
let output =
|
||||
run_git_command_with_timeout_from(&git, &["status", "--porcelain"], &cwd, fsmonitor)
|
||||
.await?;
|
||||
// Submodule worktree scans can execute filters selected by task-writable
|
||||
// Git configuration. Skip those scans while retaining gitlink changes.
|
||||
let output = run_git_command_with_timeout_from(
|
||||
&git,
|
||||
&["status", "--porcelain", "--ignore-submodules=dirty"],
|
||||
&cwd,
|
||||
fsmonitor,
|
||||
)
|
||||
.await?;
|
||||
output.status.success().then_some(!output.stdout.is_empty())
|
||||
})
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user