Merge branch 'develop' into feature/treedatagrid

# Conflicts:
#	src/Views/CommitDetail.axaml
This commit is contained in:
leo 2024-05-29 13:09:25 +08:00
commit 179887339e
10 changed files with 95 additions and 15 deletions

View file

@ -128,8 +128,31 @@ namespace SourceGit.ViewModels
if (latest.TextDiff != null)
{
latest.TextDiff.File = _option.Path;
rs = latest.TextDiff;
var repo = Preference.FindRepository(_repo);
if (repo != null && repo.Submodules.Contains(_option.Path))
{
var submoduleDiff = new Models.SubmoduleDiff();
var submoduleRoot = $"{_repo}/{_option.Path}".Replace("\\", "/");
foreach (var line in latest.TextDiff.Lines)
{
if (line.Type == Models.TextDiffLineType.Added)
{
var sha = line.Content.Substring("Subproject commit ".Length);
submoduleDiff.New = new Commands.QuerySingleCommit(submoduleRoot, sha).Result();
}
else if (line.Type == Models.TextDiffLineType.Deleted)
{
var sha = line.Content.Substring("Subproject commit ".Length);
submoduleDiff.Old = new Commands.QuerySingleCommit(submoduleRoot, sha).Result();
}
}
rs = submoduleDiff;
}
else
{
latest.TextDiff.File = _option.Path;
rs = latest.TextDiff;
}
}
else if (latest.IsBinary)
{
@ -182,7 +205,7 @@ namespace SourceGit.ViewModels
{
FileModeChange = latest.FileModeChange;
Content = rs;
IsTextDiff = latest.TextDiff != null;
IsTextDiff = rs is Models.TextDiff;
IsLoading = false;
});
});