diff --git a/src/Commands/Diff.cs b/src/Commands/Diff.cs index 090eba98..4984e3db 100644 --- a/src/Commands/Diff.cs +++ b/src/Commands/Diff.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Text.RegularExpressions; +using SourceGit.Models; namespace SourceGit.Commands { @@ -46,6 +47,22 @@ namespace SourceGit.Commands protected override void OnReadline(string line) { + if (line.StartsWith("old mode ", StringComparison.Ordinal)) + { + _result.FileModeDiff ??= new FileModeDiff(); + + _result.FileModeDiff.Old = line.Substring(9); + return; + } + + if (line.StartsWith("new mode ", StringComparison.Ordinal)) + { + _result.FileModeDiff ??= new FileModeDiff(); + + _result.FileModeDiff.New = line.Substring(9); + return; + } + if (_result.IsBinary) return; diff --git a/src/Models/DiffResult.cs b/src/Models/DiffResult.cs index 8cceced8..3325a841 100644 --- a/src/Models/DiffResult.cs +++ b/src/Models/DiffResult.cs @@ -576,11 +576,18 @@ namespace SourceGit.Models { } + public class FileModeDiff + { + public string Old { get; set; } = string.Empty; + public string New { get; set; } = string.Empty; + } + public class DiffResult { public bool IsBinary { get; set; } = false; public bool IsLFS { get; set; } = false; public TextDiff TextDiff { get; set; } = null; public LFSDiff LFSDiff { get; set; } = null; + public FileModeDiff FileModeDiff { get; set; } = null; } } diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 870868ac..10d632f6 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -131,6 +131,7 @@ NEW OLD Copy + File Mode Changed : LFS OBJECT CHANGE Next Difference NO CHANGES OR ONLY EOL CHANGES diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 330961f9..ede3aa65 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -131,6 +131,7 @@ 当前大小 原始大小 复制 + 文件权限已变化 : LFS对象变更 下一个差异 没有变更或仅有换行符差异 diff --git a/src/ViewModels/DiffContext.cs b/src/ViewModels/DiffContext.cs index 17514656..e0c9de25 100644 --- a/src/ViewModels/DiffContext.cs +++ b/src/ViewModels/DiffContext.cs @@ -3,6 +3,7 @@ using System.IO; using System.Threading.Tasks; using Avalonia; +using Avalonia.Media; using Avalonia.Media.Imaging; using Avalonia.Threading; @@ -66,6 +67,14 @@ namespace SourceGit.ViewModels set => SetProperty(ref _syncScrollOffset, value); } + public Models.FileModeDiff FileModeDiff + { + get => _fileModeDiff; + set => SetProperty(ref _fileModeDiff, value); + } + + public TextTrimming PathTrimming { get; } = new TextLeadingPrefixTrimming("...", 20); + public DiffContext(string repo, Models.DiffOption option, DiffContext previous = null) { _repo = repo; @@ -86,6 +95,11 @@ namespace SourceGit.ViewModels var latest = new Commands.Diff(repo, option).Result(); var rs = null as object; + if (latest.FileModeDiff != null) + { + FileModeDiff = latest.FileModeDiff; + } + if (latest.TextDiff != null) { latest.TextDiff.File = _option.Path; @@ -180,5 +194,6 @@ namespace SourceGit.ViewModels private bool _isTextDiff = false; private object _content = null; private Vector _syncScrollOffset = Vector.Zero; + private Models.FileModeDiff _fileModeDiff = null; } } diff --git a/src/Views/DiffView.axaml b/src/Views/DiffView.axaml index 04fff7a9..568d47b8 100644 --- a/src/Views/DiffView.axaml +++ b/src/Views/DiffView.axaml @@ -13,20 +13,28 @@ - + - - - - + + + + + + + + + + + - +