mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-20 11:44:59 +00:00
enhance: Handle file mode changes for new/deleted file (#1040)
This commit is contained in:
parent
4c63c4c90d
commit
7f8372f6b5
2 changed files with 25 additions and 1 deletions
|
@ -68,6 +68,18 @@ namespace SourceGit.Commands
|
|||
return;
|
||||
}
|
||||
|
||||
if (line.StartsWith("deleted file mode ", StringComparison.Ordinal))
|
||||
{
|
||||
_result.OldMode = line.Substring(18);
|
||||
return;
|
||||
}
|
||||
|
||||
if (line.StartsWith("new file mode ", StringComparison.Ordinal))
|
||||
{
|
||||
_result.NewMode = line.Substring(14);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_result.IsBinary)
|
||||
return;
|
||||
|
||||
|
|
|
@ -681,6 +681,18 @@ namespace SourceGit.Models
|
|||
public TextDiff TextDiff { get; set; } = null;
|
||||
public LFSDiff LFSDiff { get; set; } = null;
|
||||
|
||||
public string FileModeChange => string.IsNullOrEmpty(OldMode) ? string.Empty : $"{OldMode} → {NewMode}";
|
||||
public string FileModeChange
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrEmpty(OldMode) && string.IsNullOrEmpty(NewMode))
|
||||
return string.Empty;
|
||||
|
||||
var oldDisplay = string.IsNullOrEmpty(OldMode) ? "0" : OldMode;
|
||||
var newDisplay = string.IsNullOrEmpty(NewMode) ? "0" : NewMode;
|
||||
|
||||
return $"{oldDisplay} → {newDisplay}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue