mirror of
https://github.com/hanzoai/dev.git
synced 2026-10-17 15:34:54 +00:00
fix(core/git-worktree): gate target cache mirroring
This commit is contained in:
@@ -59,6 +59,16 @@ pub const LOCAL_DEFAULT_REMOTE: &str = "local-default";
|
||||
const BRANCH_METADATA_DIR: &str = "_branch-meta";
|
||||
const DEFAULT_BRANCH_CACHE_DIRS: &[&str] = &["node_modules"];
|
||||
|
||||
fn branch_copy_targets_enabled() -> bool {
|
||||
std::env::var("CODEX_BRANCH_COPY_TARGETS")
|
||||
.ok()
|
||||
.map(|v| {
|
||||
let v = v.to_ascii_lowercase();
|
||||
v == "1" || v == "true" || v == "yes"
|
||||
})
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
|
||||
pub struct BranchMetadata {
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
@@ -503,7 +513,9 @@ fn gather_branch_cache_candidates(src_root: &Path) -> Vec<PathBuf> {
|
||||
.map(PathBuf::from)
|
||||
.collect();
|
||||
|
||||
append_cargo_targets(src_root, &mut out);
|
||||
if branch_copy_targets_enabled() {
|
||||
append_cargo_targets(src_root, &mut out);
|
||||
}
|
||||
|
||||
if let Some(raw) = std::env::var_os("CODEX_BRANCH_COPY_DIRS") {
|
||||
out.extend(std::env::split_paths(&raw));
|
||||
|
||||
@@ -29,7 +29,9 @@ Notes
|
||||
previous Code snapshot and optionally rewind the conversation to that point.
|
||||
- `/branch [task]`: create a worktree branch and switch to it. If a
|
||||
task/description is provided, it is used when naming the branch. Must be run
|
||||
from the repository root (not inside another branch worktree).
|
||||
from the repository root (not inside another branch worktree). By default it
|
||||
only mirrors `node_modules`; set `CODEX_BRANCH_COPY_TARGETS=1` to also copy
|
||||
Rust build caches into the worktree.
|
||||
- `/merge`: merge the current worktree branch back into the default branch and
|
||||
remove the worktree. Run this from inside the worktree created by `/branch`.
|
||||
- `/review [focus]`: without arguments, opens a review picker so you can audit
|
||||
|
||||
Reference in New Issue
Block a user