feature(Submodule): supports git submodule

This commit is contained in:
leo 2020-07-22 20:14:39 +08:00
parent 789231fdc4
commit 0132fc496b
8 changed files with 359 additions and 13 deletions

View file

@ -121,4 +121,16 @@ namespace SourceGit.Helpers {
return !succ ? new ValidationResult(false, "Invalid path for patch file") : ValidationResult.ValidResult;
}
}
/// <summary>
/// Required for submodule path.
/// </summary>
public class SubmodulePathRequiredRule : ValidationRule {
public override ValidationResult Validate(object value, CultureInfo cultureInfo) {
var regex = new Regex(@"^[\w\-\._/]+$");
var path = value as string;
var succ = !string.IsNullOrEmpty(path) && regex.IsMatch(path.Trim());
return !succ ? new ValidationResult(false, "Invalid path for submodules") : ValidationResult.ValidResult;
}
}
}