diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2020-09-18 10:56:22 +0300 |
---|---|---|
committer | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2020-09-18 11:04:29 +0300 |
commit | a4fe425aa2993193326b0db162ebba915cc4eb58 (patch) | |
tree | 87f0778be4b34809b1c9ba36143055a827f4fcb5 | |
parent | b5937b10d1a386c392adb1ebced2d0c8cb038696 (diff) |
git: Support version parsing self compiled binary
In fd03f22fa8 (git: Support parsing of release-candidate versions) the
expectation was added that `git --version` output can have 4 components.
If the version output has four components, the fourth component must be
prefixed with `rc`.
Locally I run a `git` compiled from source, where the `git version`
returns: `git version 2.28.0.468.g1be91c4e2f`. Which breaks
`git.parseVersion()` as the fourth component isn't prefixed with `rc`.
This change keeps the behaviour that can flag a release as `rc`, but
doesn't return an error when the fourth component isn't `rc`.
Noted this problem when running the
`TestPostReceiveWithReferenceTransactionHook` test, which succeeds now.
-rw-r--r-- | internal/git/proto.go | 2 | ||||
-rw-r--r-- | internal/git/proto_test.go | 1 |
2 files changed, 1 insertions, 2 deletions
diff --git a/internal/git/proto.go b/internal/git/proto.go index 2ffa81612..69a414820 100644 --- a/internal/git/proto.go +++ b/internal/git/proto.go @@ -151,8 +151,6 @@ func parseVersion(versionStr string) (version, error) { if len(versionSplit) == 4 { if strings.HasPrefix(versionSplit[3], "rc") { ver.rc = true - } else { - return version{}, fmt.Errorf("unknown pre-release identifier %q", versionSplit[3]) } } diff --git a/internal/git/proto_test.go b/internal/git/proto_test.go index 6314ddb2d..3386c41d4 100644 --- a/internal/git/proto_test.go +++ b/internal/git/proto_test.go @@ -105,6 +105,7 @@ func TestSupportsReferenceTransactionHook(t *testing.T) { {"2.28.0.rc0", true}, {"2.28.0.rc2", true}, {"2.28.1", true}, + {"2.28.0.468.g1be91c4e2f", true}, {"3.0.0", true}, } { actual, err := git.SupportsReferenceTransactionHook(tc.version) |