git: match native agent workflows
This commit is contained in:
@@ -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)?;
|
||||
|
||||
Reference in New Issue
Block a user