summaryrefslogtreecommitdiffstats
path: root/pkg/commands
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2023-04-13 23:14:56 +0200
committerStefan Haller <stefan@haller-berlin.de>2023-04-15 08:36:03 +0200
commita304fed68cd2208c3e78afd9ea99446d5b5f4444 (patch)
treeee3068f3dad9931a38f519aa26d5db7c6ce9ccaa /pkg/commands
parent227b0b781cb4aab2ae613a66f2e73467670ae208 (diff)
Add GitVersion field to NewIntegrationTestArgs
It can be used to specify which git versions a given test should or should not run on.
Diffstat (limited to 'pkg/commands')
-rw-r--r--pkg/commands/git_commands/version.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/commands/git_commands/version.go b/pkg/commands/git_commands/version.go
index 0cf4b485c..1b1351df4 100644
--- a/pkg/commands/git_commands/version.go
+++ b/pkg/commands/git_commands/version.go
@@ -32,7 +32,7 @@ func ParseGitVersion(versionStr string) (*GitVersion, error) {
// versionStr should be something like:
// git version 2.39.0
// git version 2.37.1 (Apple Git-137.1)
- re := regexp.MustCompile(`[^\d]+(\d+)(\.\d+)?(\.\d+)?(.*)`)
+ re := regexp.MustCompile(`[^\d]*(\d+)(\.\d+)?(\.\d+)?(.*)`)
matches := re.FindStringSubmatch(versionStr)
if len(matches) < 5 {
@@ -65,3 +65,7 @@ func (v *GitVersion) IsOlderThan(major, minor, patch int) bool {
required := major*1000*1000 + minor*1000 + patch
return actual < required
}
+
+func (v *GitVersion) IsOlderThanVersion(version *GitVersion) bool {
+ return v.IsOlderThan(version.Major, version.Minor, version.Patch)
+}