diff --git a/src/Converters/StringConverters.cs b/src/Converters/StringConverters.cs index f743f69f..35491a16 100644 --- a/src/Converters/StringConverters.cs +++ b/src/Converters/StringConverters.cs @@ -1,12 +1,13 @@ using System; using System.Globalization; +using System.Text.RegularExpressions; using Avalonia.Data.Converters; using Avalonia.Styling; namespace SourceGit.Converters { - public static class StringConverters + public static partial class StringConverters { public class ToLocaleConverter : IValueConverter { @@ -69,5 +70,26 @@ namespace SourceGit.Converters public static readonly FuncValueConverter ToShortSHA = new FuncValueConverter(v => v.Length > 10 ? v.Substring(0, 10) : v); + + public static readonly FuncValueConverter UnderRecommendGitVersion = + new(v => + { + var match = REG_GIT_VERSION().Match(v ?? ""); + if (match.Success) + { + var major = int.Parse(match.Groups[1].Value); + var minor = int.Parse(match.Groups[2].Value); + var build = int.Parse(match.Groups[3].Value); + + return new Version(major, minor, build) < MINIMAL_GIT_VERSION; + } + + return true; + }); + + [GeneratedRegex(@"^[\s\w]*(\d+)\.(\d+)[\.\-](\d+).*$")] + private static partial Regex REG_GIT_VERSION(); + + private static readonly Version MINIMAL_GIT_VERSION = new Version(2, 23, 0); } } diff --git a/src/Resources/Locales/en_US.axaml b/src/Resources/Locales/en_US.axaml index 0e4e3068..e1e8565f 100644 --- a/src/Resources/Locales/en_US.axaml +++ b/src/Resources/Locales/en_US.axaml @@ -308,6 +308,7 @@ User Name Global git user name Git version + Git (>= 2.23.0) is required by this app GPG SIGNING Commit GPG signing Install Path diff --git a/src/Resources/Locales/zh_CN.axaml b/src/Resources/Locales/zh_CN.axaml index 0900d081..484f7c66 100644 --- a/src/Resources/Locales/zh_CN.axaml +++ b/src/Resources/Locales/zh_CN.axaml @@ -308,6 +308,7 @@ 用户名 默认GIT用户名 Git 版本 + 本软件要求GIT最低版本为2.23.0 GPG签名 启用提交签名 可执行文件位置 diff --git a/src/Resources/Styles.axaml b/src/Resources/Styles.axaml index daf7ce22..37a0670f 100644 --- a/src/Resources/Styles.axaml +++ b/src/Resources/Styles.axaml @@ -60,6 +60,12 @@ + +