mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 04:04:59 +00:00
Source Generated Regex
This commit is contained in:
parent
f93dec5e6a
commit
c0a079de41
19 changed files with 101 additions and 64 deletions
|
@ -2,9 +2,11 @@
|
|||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace SourceGit.Commands {
|
||||
public class QuerySubmodules : Command {
|
||||
private readonly Regex REG_FORMAT1 = new Regex(@"^[\-\+ ][0-9a-f]+\s(.*)\s\(.*\)$");
|
||||
private readonly Regex REG_FORMAT2 = new Regex(@"^[\-\+ ][0-9a-f]+\s(.*)$");
|
||||
public partial class QuerySubmodules : Command {
|
||||
[GeneratedRegex(@"^[\-\+ ][0-9a-f]+\s(.*)\s\(.*\)$")]
|
||||
private static partial Regex REG_FORMAT1();
|
||||
[GeneratedRegex(@"^[\-\+ ][0-9a-f]+\s(.*)$")]
|
||||
private static partial Regex REG_FORMAT2();
|
||||
|
||||
public QuerySubmodules(string repo) {
|
||||
WorkingDirectory = repo;
|
||||
|
@ -18,13 +20,13 @@ namespace SourceGit.Commands {
|
|||
}
|
||||
|
||||
protected override void OnReadline(string line) {
|
||||
var match = REG_FORMAT1.Match(line);
|
||||
var match = REG_FORMAT1().Match(line);
|
||||
if (match.Success) {
|
||||
_submodules.Add(match.Groups[1].Value);
|
||||
return;
|
||||
}
|
||||
|
||||
match = REG_FORMAT2.Match(line);
|
||||
match = REG_FORMAT2().Match(line);
|
||||
if (match.Success) {
|
||||
_submodules.Add(match.Groups[1].Value);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue