MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / git_add_all

Function git_add_all

crates/opencode-session/src/snapshot.rs:251–264  ·  view source on GitHub ↗
(directory: &Path, git_dir: &Path)

Source from the content-addressed store, hash-verified

249}
250
251fn git_add_all(directory: &Path, git_dir: &Path) -> Result<()> {
252 // Exclude the snapshot repo itself when it lives under worktree.
253 for args in [
254 vec!["add", "-A", "--", ".", ":(exclude).opencode/snapshot"],
255 vec!["add", "-A", "--", ".", ":!/.opencode/snapshot"],
256 vec!["add", "-A", "--", ".", ":!.opencode/snapshot"],
257 ] {
258 if git_output(directory, git_dir, &args).is_ok() {
259 return Ok(());
260 }
261 }
262
263 anyhow::bail!("failed to add worktree files to snapshot index with snapshot-dir exclusion")
264}
265
266fn relative_to_worktree(worktree: &Path, input: &Path) -> String {
267 if input.is_absolute() {

Callers 2

trackMethod · 0.85
diffMethod · 0.85

Calls 1

git_outputFunction · 0.70

Tested by

no test coverage detected