2024-02-05 23:08:37 -08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
|
|
|
|
|
namespace SourceGit.Commands {
|
2024-03-16 02:09:27 -07:00
|
|
|
|
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();
|
2024-02-05 23:08:37 -08:00
|
|
|
|
|
|
|
|
|
public QuerySubmodules(string repo) {
|
|
|
|
|
WorkingDirectory = repo;
|
|
|
|
|
Context = repo;
|
|
|
|
|
Args = "submodule status";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<string> Result() {
|
|
|
|
|
Exec();
|
|
|
|
|
return _submodules;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void OnReadline(string line) {
|
2024-03-16 02:09:27 -07:00
|
|
|
|
var match = REG_FORMAT1().Match(line);
|
2024-02-20 20:26:09 -08:00
|
|
|
|
if (match.Success) {
|
|
|
|
|
_submodules.Add(match.Groups[1].Value);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-16 02:09:27 -07:00
|
|
|
|
match = REG_FORMAT2().Match(line);
|
2024-02-20 20:26:09 -08:00
|
|
|
|
if (match.Success) {
|
|
|
|
|
_submodules.Add(match.Groups[1].Value);
|
|
|
|
|
}
|
2024-02-05 23:08:37 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<string> _submodules = new List<string>();
|
|
|
|
|
}
|
|
|
|
|
}
|