# Ghost snapshot ignores This PR should close #7067, #7395, #7405. Prior to this change the ghost snapshot task ran `git status --ignored=matching` so the report picked up literally every ignored file. When a directory only contained entries matched by patterns such as `dozens/*.txt`, `/test123/generated/*.html`, or `/wp-includes/*`, Git still enumerated them and the large-untracked-dir detection treated the parent directory as “large,” even though everything inside was intentionally ignored. By removing `--ignored=matching` we only capture true untracked paths now, so those patterns stay out of the snapshot report and no longer trigger the “large untracked directories” warning. --------- Signed-off-by: lionelchg <lionel.cheng@hotmail.fr> Co-authored-by: lionelchg <lionel.cheng@hotmail.fr> |
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||
| README.md | ||
codex-git
Helpers for interacting with git, including patch application and worktree snapshot utilities.
use std::path::Path;
use codex_git::{
apply_git_patch, create_ghost_commit, restore_ghost_commit, ApplyGitRequest,
CreateGhostCommitOptions,
};
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)?;
// Capture the current working tree as an unreferenced commit.
let ghost = create_ghost_commit(&CreateGhostCommitOptions::new(repo))?;
// Later, undo back to that state.
restore_ghost_commit(repo, &ghost)?;
Pass a custom message with .message("…") or force-include ignored files with
.force_include(["ignored.log".into()]).