mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 20:54:59 +00:00
Source Generated Regex
This commit is contained in:
parent
f93dec5e6a
commit
c0a079de41
19 changed files with 101 additions and 64 deletions
|
@ -3,8 +3,10 @@ using System.Text.RegularExpressions;
|
|||
using System.Threading.Tasks;
|
||||
|
||||
namespace SourceGit.ViewModels {
|
||||
public class InitGitFlow : Popup {
|
||||
private static readonly Regex TAG_PREFIX = new Regex(@"^[\w\-/\.]+$");
|
||||
public partial class InitGitFlow : Popup {
|
||||
|
||||
[GeneratedRegex(@"^[\w\-/\.]+$")]
|
||||
private static partial Regex TAG_PREFIX();
|
||||
|
||||
[Required(ErrorMessage = "Master branch name is required!!!")]
|
||||
[RegularExpression(@"^[\w\-/\.]+$", ErrorMessage = "Bad branch name format!")]
|
||||
|
@ -63,7 +65,7 @@ namespace SourceGit.ViewModels {
|
|||
}
|
||||
|
||||
public static ValidationResult ValidateTagPrefix(string tagPrefix, ValidationContext ctx) {
|
||||
if (!string.IsNullOrWhiteSpace(tagPrefix) && !TAG_PREFIX.IsMatch(tagPrefix)) {
|
||||
if (!string.IsNullOrWhiteSpace(tagPrefix) && !TAG_PREFIX().IsMatch(tagPrefix)) {
|
||||
return new ValidationResult("Bad tag prefix format!");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue