Git Patch Applier (src/apply.rs)

openinterpreter · codex-rs/git-utils/src/apply.rs · rust · Apache-2.0
dev-tools, cli, lang:rust, tag:patch

Applies unified diff patches via the system git binary, supporting dry-run preflight checks and parsing affected file paths from output.

// Source: https://github.com/openinterpreter/openinterpreter | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
//! Helpers for applying unified diffs using the system `git` binary.
//!
//! The entry point is [`apply_git_patch`], which writes a diff to a temporary
//! file, shells out to `git apply` with the right flags, and then parses the
//! command’s output into structured details. Callers can opt into dry-run
//! mode via [`ApplyGitRequest::preflight`] and inspect the resulting paths to
//! learn what would change before applying for real.

use codex_protocol::shell_environment::scrub_non_inheritable_env_vars;
use once_cell::sync::Lazy;
use regex::Regex;
use std::ffi::OsStr;
us

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key