git: match native agent workflows

This commit is contained in:
2026-11-06 19:07:28 +00:00
parent b5462cc366
commit 6daa53cca4
11 changed files with 1641 additions and 75 deletions
+12
View File
@@ -373,6 +373,18 @@ pub fn diff(p: DiffParams) -> Result<Vec<FileDiff>> {
let repo = repo::open(&p.repo)?;
let (old, new, work) = match (&p.from, &p.to, p.staged.unwrap_or(false)) {
(Some(a), Some(b), false) => (tree(&repo, a)?, tree(&repo, b)?, false),
(Some(a), None, staged) => {
let (index, _) = index(&repo)?;
if staged {
(tree(&repo, a)?, index, false)
} else {
(
tree(&repo, a)?,
worktree(&repo, &index, p.path.as_deref())?,
true,
)
}
}
(None, None, staged) => {
repo::worktree(&repo)?;
let (index, conflicts) = index(&repo)?;