(directory: &Path, git_dir: &Path)
| 249 | } |
| 250 | |
| 251 | fn 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 | |
| 266 | fn relative_to_worktree(worktree: &Path, input: &Path) -> String { |
| 267 | if input.is_absolute() { |
no test coverage detected