Skip to content

Commit f8b91ec

Browse files
committed
enhance: use string.Equals instead of operator ==
Signed-off-by: leo <longshuang@msn.cn>
1 parent 3bf2da2 commit f8b91ec

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/ViewModels/Histories.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public List<Models.Commit> Commits
6666
if (SetProperty(ref _commits, value))
6767
{
6868
if (value.Count > 0 && lastSelected != null)
69-
SelectedCommit = value.Find(x => x.SHA == lastSelected.SHA);
69+
SelectedCommit = value.Find(x => x.SHA.Equals(lastSelected.SHA, StringComparison.Ordinal));
7070
}
7171
}
7272
}
@@ -222,8 +222,8 @@ public void Select(IList commits)
222222
else if (commits.Count == 1)
223223
{
224224
var commit = (commits[0] as Models.Commit)!;
225-
if (_repo.SearchCommitContext.Selected == null || _repo.SearchCommitContext.Selected.SHA != commit.SHA)
226-
_repo.SearchCommitContext.Selected = _repo.SearchCommitContext.Results?.Find(x => x.SHA == commit.SHA);
225+
if (_repo.SearchCommitContext.Selected == null || !_repo.SearchCommitContext.Selected.SHA.Equals(commit.SHA, StringComparison.Ordinal))
226+
_repo.SearchCommitContext.Selected = _repo.SearchCommitContext.Results?.Find(x => x.SHA.Equals(commit.SHA, StringComparison.Ordinal));
227227

228228
SelectedCommit = commit;
229229
NavigationId = _navigationId + 1;
@@ -366,7 +366,7 @@ public async Task CherryPickAsync(Models.Commit commit)
366366
var parents = new List<Models.Commit>();
367367
foreach (var sha in commit.Parents)
368368
{
369-
var parent = _commits.Find(x => x.SHA == sha);
369+
var parent = _commits.Find(x => x.SHA.Equals(sha, StringComparison.Ordinal));
370370
if (parent == null)
371371
parent = await new Commands.QuerySingleCommit(_repo.FullPath, sha).GetResultAsync();
372372

src/Views/CommitMessagePresenter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ private void ProcessHoverCommitLink(Models.InlineElement link)
268268
{
269269
var currentParent = this.FindAncestorOfType<CommitBaseInfo>();
270270
if (currentParent is { DataContext: ViewModels.CommitDetail currentDetail } &&
271-
currentDetail.Commit.SHA == lastDetailCommit)
271+
currentDetail.Commit.SHA.Equals(lastDetailCommit, StringComparison.Ordinal))
272272
{
273273
_inlineCommits.TryAdd(sha, c);
274274
if (_lastHover == link && c != null)

0 commit comments

Comments
 (0)