mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-23 13:14:59 +00:00
code_review: PR #1292
Use syntax `String.AsSpan(int start, int len)` instead of `String.AsSpan().Slice(int start, int len)` Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
15ee2dac91
commit
e8bf58f6c3
3 changed files with 8 additions and 8 deletions
|
@ -24,7 +24,7 @@ namespace SourceGit.Models
|
|||
{
|
||||
var trimmedUrl = url.AsSpan();
|
||||
if (url.EndsWith(".git"))
|
||||
trimmedUrl = url.AsSpan().Slice(0, url.Length - 4);
|
||||
trimmedUrl = url.AsSpan(0, url.Length - 4);
|
||||
|
||||
if (url.StartsWith("https://github.com/", StringComparison.Ordinal))
|
||||
outs.Add(new($"Github ({trimmedUrl.Slice(19)})", $"{url}/commit/"));
|
||||
|
|
|
@ -344,28 +344,28 @@ namespace SourceGit.Models
|
|||
if (filter.Mode == FilterMode.Included)
|
||||
includedRefs.Add(filter.Pattern);
|
||||
else if (filter.Mode == FilterMode.Excluded)
|
||||
excludedBranches.Add($"--exclude=\"{filter.Pattern.AsSpan().Slice(11)}\" --decorate-refs-exclude=\"{filter.Pattern}\"");
|
||||
excludedBranches.Add($"--exclude=\"{filter.Pattern.AsSpan(11)}\" --decorate-refs-exclude=\"{filter.Pattern}\"");
|
||||
}
|
||||
else if (filter.Type == FilterType.LocalBranchFolder)
|
||||
{
|
||||
if (filter.Mode == FilterMode.Included)
|
||||
includedRefs.Add($"--branches={filter.Pattern.AsSpan().Slice(11)}/*");
|
||||
includedRefs.Add($"--branches={filter.Pattern.AsSpan(11)}/*");
|
||||
else if (filter.Mode == FilterMode.Excluded)
|
||||
excludedBranches.Add($"--exclude=\"{filter.Pattern.AsSpan().Slice(11)}/*\" --decorate-refs-exclude=\"{filter.Pattern}/*\"");
|
||||
excludedBranches.Add($"--exclude=\"{filter.Pattern.AsSpan(11)}/*\" --decorate-refs-exclude=\"{filter.Pattern}/*\"");
|
||||
}
|
||||
else if (filter.Type == FilterType.RemoteBranch)
|
||||
{
|
||||
if (filter.Mode == FilterMode.Included)
|
||||
includedRefs.Add(filter.Pattern);
|
||||
else if (filter.Mode == FilterMode.Excluded)
|
||||
excludedRemotes.Add($"--exclude=\"{filter.Pattern.AsSpan().Slice(13)}\" --decorate-refs-exclude=\"{filter.Pattern}\"");
|
||||
excludedRemotes.Add($"--exclude=\"{filter.Pattern.AsSpan(13)}\" --decorate-refs-exclude=\"{filter.Pattern}\"");
|
||||
}
|
||||
else if (filter.Type == FilterType.RemoteBranchFolder)
|
||||
{
|
||||
if (filter.Mode == FilterMode.Included)
|
||||
includedRefs.Add($"--remotes={filter.Pattern.AsSpan().Slice(13)}/*");
|
||||
includedRefs.Add($"--remotes={filter.Pattern.AsSpan(13)}/*");
|
||||
else if (filter.Mode == FilterMode.Excluded)
|
||||
excludedRemotes.Add($"--exclude=\"{filter.Pattern.AsSpan().Slice(13)}/*\" --decorate-refs-exclude=\"{filter.Pattern}/*\"");
|
||||
excludedRemotes.Add($"--exclude=\"{filter.Pattern.AsSpan(13)}/*\" --decorate-refs-exclude=\"{filter.Pattern}/*\"");
|
||||
}
|
||||
else if (filter.Type == FilterType.Tag)
|
||||
{
|
||||
|
|
|
@ -1502,7 +1502,7 @@ namespace SourceGit.Views
|
|||
{
|
||||
if (line.Content.Length > 10000)
|
||||
{
|
||||
builder.Append(line.Content.AsSpan().Slice(0, 1000));
|
||||
builder.Append(line.Content.AsSpan(0, 1000));
|
||||
builder.Append($"...({line.Content.Length - 1000} characters trimmed)");
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue