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,9 @@
using System.Text.RegularExpressions;
namespace SourceGit.Commands {
public class QueryCommitChanges : Command {
private static readonly Regex REG_FORMAT = new Regex(@"^(\s?[\w\?]{1,4})\s+(.+)$");
public partial class QueryCommitChanges : Command {
[GeneratedRegex(@"^(\s?[\w\?]{1,4})\s+(.+)$")]
private static partial Regex REG_FORMAT();
public QueryCommitChanges(string repo, string commitSHA) {
WorkingDirectory = repo;
@ -18,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 };