Skip to content

Commit 8553351

Browse files
committed
remove bad TrimEnd call
1 parent 8c89215 commit 8553351

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Elastic.Documentation/GitCheckoutInformation.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44

55
using System.IO.Abstractions;
66
using System.Text.Json.Serialization;
7+
using System.Text.RegularExpressions;
78
using Microsoft.Extensions.Logging;
89
using SoftCircuits.IniFileParser;
910

1011
namespace Elastic.Documentation;
1112

12-
public record GitCheckoutInformation
13+
public partial record GitCheckoutInformation
1314
{
1415
public static GitCheckoutInformation Unavailable { get; } = new()
1516
{
@@ -99,7 +100,7 @@ public static GitCheckoutInformation Create(IDirectoryInfo? source, IFileSystem
99100
remote = "elastic/docs-builder-unknown";
100101
logger?.LogInformation("Remote from fallback: {GitRemote}", remote);
101102
}
102-
remote = remote.AsSpan().TrimEnd("git").TrimEnd('.').ToString();
103+
remote = CutOffGitExtension().Replace(remote, string.Empty);
103104

104105
var info = new GitCheckoutInformation
105106
{
@@ -139,4 +140,7 @@ string BranchTrackingRemote(string b, IniFile c)
139140
return remote ?? string.Empty;
140141
}
141142
}
143+
144+
[GeneratedRegex(@"\.git$", RegexOptions.IgnoreCase, "en-US")]
145+
private static partial Regex CutOffGitExtension();
142146
}

0 commit comments

Comments
 (0)