Source Generated Regex

This commit is contained in:
Enner Pérez 2024-03-16 04:09:27 -05:00
parent f93dec5e6a
commit c0a079de41
19 changed files with 101 additions and 64 deletions

View file

@ -2,8 +2,10 @@
using System.Text.RegularExpressions;
namespace SourceGit.Commands {
public class QueryStashChanges : Command {
private static readonly Regex REG_FORMAT = new Regex(@"^(\s?[\w\?]{1,4})\s+(.+)$");
public partial class QueryStashChanges : Command {
[GeneratedRegex(@"^(\s?[\w\?]{1,4})\s+(.+)$")]
private static partial Regex REG_FORMAT();
public QueryStashChanges(string repo, string sha) {
WorkingDirectory = repo;
@ -17,7 +19,7 @@ namespace SourceGit.Commands {
}
protected override void OnReadline(string line) {
var match = REG_FORMAT.Match(line);
var match = REG_FORMAT().Match(line);
if (!match.Success) return;
var change = new Models.Change() { Path = match.Groups[2].Value };