git-utils: neutralize off-path filter helpers

This commit is contained in:
Chris Bookholt
2026-07-01 15:58:52 -07:00
parent 4bf391509e
commit bed78fad06
5 changed files with 395 additions and 12 deletions
+4 -3
View File
@@ -55,7 +55,10 @@ pub fn apply_git_patch(req: &ApplyGitRequest) -> io::Result<ApplyGitResult> {
// Keep tmpdir alive until function end to ensure the file exists
let _guard = tmpdir;
let patch_paths = extract_effective_paths_from_patch(&git, &patch_path, req.revert)?;
ensure_no_selected_executable_git_filters(&git, &git_root, &patch_paths, &cfg_parts)?;
let filter_guard =
ensure_no_selected_executable_git_filters(&git, &git_root, &patch_paths, &cfg_parts)?;
cfg_parts.extend(safe_git_config_parts());
cfg_parts.extend_from_slice(filter_guard.git_config_args());
if req.revert && !req.preflight {
// Stage WT paths first to avoid index mismatch on revert.
@@ -68,8 +71,6 @@ pub fn apply_git_patch(req: &ApplyGitRequest) -> io::Result<ApplyGitResult> {
args.push("-R".into());
}
cfg_parts.extend(safe_git_config_parts());
args.push(patch_path.to_string_lossy().to_string());
// Optional preflight: dry-run only; do not modify working tree