refactor: diff for staged file with --amend enabled (#1231)

Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
leo 2025-04-22 19:20:27 +08:00
parent 78f4809875
commit 345ad06aba
No known key found for this signature in database
4 changed files with 9 additions and 3 deletions

View file

@ -16,6 +16,7 @@ namespace SourceGit.Commands
WorkingDirectory = repo;
Context = repo;
Args = $"diff-index --cached -M {parent}";
_parent = parent;
}
public List<Models.Change> Result()
@ -37,6 +38,7 @@ namespace SourceGit.Commands
{
FileMode = match.Groups[1].Value,
ObjectHash = match.Groups[2].Value,
ParentSHA = _parent,
},
};
change.Set(Models.ChangeState.Renamed);
@ -54,6 +56,7 @@ namespace SourceGit.Commands
{
FileMode = match.Groups[1].Value,
ObjectHash = match.Groups[2].Value,
ParentSHA = _parent,
},
};
@ -88,5 +91,7 @@ namespace SourceGit.Commands
return [];
}
private string _parent = string.Empty;
}
}