mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-08 12:25:00 +00:00
refactor: use a new Models.ChangeState.Conflicted
to represent all the unmerged
file state (#1359)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
30d4c1008a
commit
ef53dd0025
6 changed files with 87 additions and 135 deletions
|
@ -18,8 +18,8 @@ namespace SourceGit.Models
|
|||
Deleted,
|
||||
Renamed,
|
||||
Copied,
|
||||
Unmerged,
|
||||
Untracked
|
||||
Untracked,
|
||||
Conflicted,
|
||||
}
|
||||
|
||||
public class ChangeDataForAmend
|
||||
|
@ -36,20 +36,7 @@ namespace SourceGit.Models
|
|||
public string Path { get; set; } = "";
|
||||
public string OriginalPath { get; set; } = "";
|
||||
public ChangeDataForAmend DataForAmend { get; set; } = null;
|
||||
|
||||
public bool IsConflict
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Index == ChangeState.Unmerged || WorkTree == ChangeState.Unmerged)
|
||||
return true;
|
||||
if (Index == ChangeState.Added && WorkTree == ChangeState.Added)
|
||||
return true;
|
||||
if (Index == ChangeState.Deleted && WorkTree == ChangeState.Deleted)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public bool IsConflicted => WorkTree == ChangeState.Conflicted;
|
||||
|
||||
public void Set(ChangeState index, ChangeState workTree = ChangeState.None)
|
||||
{
|
||||
|
@ -77,6 +64,7 @@ namespace SourceGit.Models
|
|||
|
||||
if (Path[0] == '"')
|
||||
Path = Path.Substring(1, Path.Length - 2);
|
||||
|
||||
if (!string.IsNullOrEmpty(OriginalPath) && OriginalPath[0] == '"')
|
||||
OriginalPath = OriginalPath.Substring(1, OriginalPath.Length - 2);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue