mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-22 04:34:59 +00:00
feat: show tooltip if git version too low
This commit is contained in:
parent
0b09d210be
commit
2f7ef1ef2b
5 changed files with 37 additions and 4 deletions
|
@ -69,5 +69,22 @@ namespace SourceGit.Converters
|
|||
|
||||
public static readonly FuncValueConverter<string, string> ToShortSHA =
|
||||
new FuncValueConverter<string, string>(v => v.Length > 10 ? v.Substring(0, 10) : v);
|
||||
|
||||
public static readonly FuncValueConverter<string, bool> UnderRecommendGitVersion =
|
||||
new(v =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(v))
|
||||
return true;
|
||||
var versionParts = v.Split(new[] { '.', '-' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (versionParts.Length < 3)
|
||||
return true;
|
||||
if (!int.TryParse(versionParts[0], out var major) ||
|
||||
!int.TryParse(versionParts[1], out var minor) ||
|
||||
!int.TryParse(versionParts[2], out var build))
|
||||
return true;
|
||||
var gitVersion = new Version(major, minor, build);
|
||||
var targetVersion = new Version(2, 23, 0);
|
||||
return gitVersion < targetVersion;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue