mirror of
https://github.com/openai/codex.git
synced 2026-10-21 05:22:21 +00:00
Backport #49164 and #49308 onto the content commit of 0.159.1 to suppress Windows console flashing reported in #48074. The two cherry-picks applied without conflicts; no other fixes are included. Cargo remains at the release-branch content version, 0.0.0. Validation: `git diff --check` passes. Native Windows execution has not been validated on this exact candidate. Keep this PR in draft pending required review and a focused Windows smoke test: from a non-elevated PowerShell host with workspace-write and the unelevated sandbox, verify built-ins and external whoami.exe, cmd.exe, Git and nested PowerShell terminate with expected output, both with a matching managed daemon and with --no-daemon, without visible console flashes. Record exact binary/candidate SHA, CLI and daemon versions, CODEX_HOME, configuration, exit codes and durations. The alpha.2 reports in https://github.com/openai/codex/issues/48074#issuecomment-5898123863 and https://github.com/openai/codex/issues/48074#issuecomment-5897958690 conflict on execution safety; they do not establish a causal regression or validate this exact backport. Do not publish 0.159.2 until the evidence and required checks/review are complete. --------- Co-authored-by: Eric Traut <etraut@openai.com>
codex-git-utils
Helpers for interacting with git, including patch application. The crate also
exposes a lightweight baseline API for internal directories that use git only
as a resettable diff mechanism: ensure_git_baseline_repository preserves a
usable root/.git baseline or creates one when it is missing or unusable,
reset_git_repository replaces root/.git with a fresh one-commit baseline,
and diff_since_latest_init returns structured file changes plus a unified
diff from that baseline to the current directory contents.
use std::path::Path;
use codex_git_utils::{apply_git_patch, ApplyGitRequest};
let repo = Path::new("/path/to/repo");
// Apply a patch (omitted here) to the repository.
let request = ApplyGitRequest {
cwd: repo.to_path_buf(),
diff: String::from("...diff contents..."),
revert: false,
preflight: false,
};
let result = apply_git_patch(&request)?;