mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-24 11:54:59 +00:00
refactor: apply early return to select logic
- Refactor 'if-else' snippet to 'ifs' with early returns
This commit is contained in:
parent
a824adf6d3
commit
c84845580a
1 changed files with 13 additions and 7 deletions
|
@ -150,8 +150,11 @@ namespace SourceGit.ViewModels
|
||||||
{
|
{
|
||||||
_repo.SearchResultSelectedCommit = null;
|
_repo.SearchResultSelectedCommit = null;
|
||||||
DetailContext = null;
|
DetailContext = null;
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (commits.Count == 1)
|
|
||||||
|
if (commits.Count == 1)
|
||||||
{
|
{
|
||||||
var commit = (commits[0] as Models.Commit)!;
|
var commit = (commits[0] as Models.Commit)!;
|
||||||
if (_repo.SearchResultSelectedCommit == null || _repo.SearchResultSelectedCommit.SHA != commit.SHA)
|
if (_repo.SearchResultSelectedCommit == null || _repo.SearchResultSelectedCommit.SHA != commit.SHA)
|
||||||
|
@ -170,20 +173,23 @@ namespace SourceGit.ViewModels
|
||||||
commitDetail.Commit = commit;
|
commitDetail.Commit = commit;
|
||||||
DetailContext = commitDetail;
|
DetailContext = commitDetail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (commits.Count == 2)
|
|
||||||
|
if (commits.Count == 2)
|
||||||
{
|
{
|
||||||
_repo.SearchResultSelectedCommit = null;
|
_repo.SearchResultSelectedCommit = null;
|
||||||
|
|
||||||
var end = commits[0] as Models.Commit;
|
var end = commits[0] as Models.Commit;
|
||||||
var start = commits[1] as Models.Commit;
|
var start = commits[1] as Models.Commit;
|
||||||
DetailContext = new RevisionCompare(_repo.FullPath, start, end);
|
DetailContext = new RevisionCompare(_repo.FullPath, start, end);
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
_repo.SearchResultSelectedCommit = null;
|
||||||
_repo.SearchResultSelectedCommit = null;
|
DetailContext = commits.Count;
|
||||||
DetailContext = commits.Count;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DoubleTapped(Models.Commit commit)
|
public void DoubleTapped(Models.Commit commit)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue