mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-21 10:25:00 +00:00
code_review: PR #1402
- it's unnecessary to implement `IEnumerable` interface - we should check `IsIntersecting` before creating `InlineElement` to avoid unnecessary works suck as running `git cat-file -t <hash>` - sort whold list after all elements have been added to avoid unnecessary memmove in `Insert` Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
fe54d30b70
commit
84fb39f97a
7 changed files with 52 additions and 88 deletions
|
@ -638,6 +638,8 @@ namespace SourceGit.ViewModels
|
|||
|
||||
var start = match.Index;
|
||||
var len = match.Length;
|
||||
if (inlines.Intersect(start, len) != null)
|
||||
continue;
|
||||
|
||||
var url = message.Substring(start, len);
|
||||
if (Uri.IsWellFormedUriString(url, UriKind.Absolute))
|
||||
|
@ -653,6 +655,8 @@ namespace SourceGit.ViewModels
|
|||
|
||||
var start = match.Index;
|
||||
var len = match.Length;
|
||||
if (inlines.Intersect(start, len) != null)
|
||||
continue;
|
||||
|
||||
var sha = match.Groups[1].Value;
|
||||
var isCommitSHA = new Commands.IsCommitSHA(_repo.FullPath, sha).Result();
|
||||
|
@ -660,6 +664,7 @@ namespace SourceGit.ViewModels
|
|||
inlines.Add(new Models.InlineElement(Models.InlineElementType.CommitSHA, start, len, sha));
|
||||
}
|
||||
|
||||
inlines.Sort();
|
||||
return inlines;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue