mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-18 00:45:00 +00:00
perf: minimize temporary strings for better performance (#1255)
This commit is contained in:
parent
53a55467f1
commit
48bb8e91de
8 changed files with 35 additions and 23 deletions
|
@ -1,4 +1,5 @@
|
|||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace SourceGit.Models
|
||||
{
|
||||
|
@ -22,12 +23,12 @@ namespace SourceGit.Models
|
|||
get
|
||||
{
|
||||
if (IsDetached)
|
||||
return $"deteched HEAD at {Head.Substring(10)}";
|
||||
return $"deteched HEAD at {Head.AsSpan().Slice(10)}";
|
||||
|
||||
if (Branch.StartsWith("refs/heads/", System.StringComparison.Ordinal))
|
||||
if (Branch.StartsWith("refs/heads/", StringComparison.Ordinal))
|
||||
return Branch.Substring(11);
|
||||
|
||||
if (Branch.StartsWith("refs/remotes/", System.StringComparison.Ordinal))
|
||||
if (Branch.StartsWith("refs/remotes/", StringComparison.Ordinal))
|
||||
return Branch.Substring(13);
|
||||
|
||||
return Branch;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue