mirror of
https://github.com/openai/codex.git
synced 2026-09-13 11:47:17 +00:00
## What changed - Add the experimental `worktrees` feature and a shared `--worktree` flag for new and forked `codex exec` sessions. - Create each enabled session in a managed Git worktree, use that checkout as the session working directory, and bind the checkout to the new thread. - Share the configured worktree pool with Desktop while leaving automatic cleanup disabled for CLI allocations. - Reject unsupported commands, remote execution, ignored user configuration, ephemeral sessions, and use without the feature enabled before allocating a worktree. ## Testing - Cover flag placement and inheritance, supported and rejected command combinations, worktree allocation and thread ownership, configuration gating, and compatibility with existing worktree-backed sessions. GitOrigin-RevId: 011ff4639b09e8992c50d7b823df23e71798670e
31 lines
870 B
Rust
31 lines
870 B
Rust
//! Tests shared command-line option inheritance.
|
|
|
|
use super::SharedCliOptions;
|
|
|
|
#[test]
|
|
fn inherits_worktree_from_root_without_clearing_subcommand_choice() {
|
|
let mut options = SharedCliOptions::default();
|
|
let root = SharedCliOptions {
|
|
worktree: true,
|
|
..Default::default()
|
|
};
|
|
options.inherit_exec_root_options(&root);
|
|
assert!(options.worktree);
|
|
|
|
options.inherit_exec_root_options(&SharedCliOptions::default());
|
|
assert!(options.worktree);
|
|
}
|
|
|
|
#[test]
|
|
fn applies_worktree_subcommand_override_without_clearing_root_choice() {
|
|
let mut options = SharedCliOptions::default();
|
|
options.apply_subcommand_overrides(SharedCliOptions {
|
|
worktree: true,
|
|
..Default::default()
|
|
});
|
|
assert!(options.worktree);
|
|
|
|
options.apply_subcommand_overrides(SharedCliOptions::default());
|
|
assert!(options.worktree);
|
|
}
|