You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Write initial tests
Signed-off-by: Paul Larsen <[email protected]>
* Improve git tag semver resolution
Signed-off-by: Paul Larsen <[email protected]>
* Add company to list of users
Signed-off-by: Paul Larsen <[email protected]>
* Fix broken error string check
Signed-off-by: Paul Larsen <[email protected]>
* Fix incorrect semver test assumption
Signed-off-by: Paul Larsen <[email protected]>
* switch to debug statement
Signed-off-by: Paul Larsen <[email protected]>
* Add more testcases for review
Signed-off-by: Paul Larsen <[email protected]>
* review comments
Signed-off-by: Paul Larsen <[email protected]>
---------
Signed-off-by: Paul Larsen <[email protected]>
// If we get here, revision string had non hexadecimal characters (indicating its a branch, tag,
686
681
// or symbolic ref) and we were unable to resolve it to a commit SHA.
687
-
return"", fmt.Errorf("Unable to resolve '%s' to a commit SHA", revision)
682
+
return"", fmt.Errorf("unable to resolve '%s' to a commit SHA", revision)
688
683
}
689
684
690
685
// resolveSemverRevision is a part of the lsRemote method workflow.
691
-
// When the user configure correctly the Git repository revision and the revision is a valid semver constraint
692
-
// only the for loop in this function will run, otherwise the lsRemote loop will try to resolve the revision.
693
-
// Some examples to illustrate the actual behavior, if:
694
-
// * The revision is "v0.1.*"/"0.1.*" or "v0.1.2"/"0.1.2" and there's a tag matching that constraint only this function loop will run;
695
-
// * The revision is "v0.1.*"/"0.1.*" or "0.1.2"/"0.1.2" and there is no tag matching that constraint this function loop and lsRemote loop will run for backward compatibility;
696
-
// * The revision is "custom-tag" only the lsRemote loop will run because that revision is an invalid semver;
697
-
// * The revision is "master-branch" only the lsRemote loop will run because that revision is an invalid semver;
// When the user correctly configures the Git repository revision, and that revision is a valid semver constraint, we
687
+
// use this logic path rather than the standard lsRemote revision resolution loop.
688
+
// Some examples to illustrate the actual behavior - if the revision is:
689
+
// * "v0.1.2"/"0.1.2" or "v0.1"/"0.1", then this is not a constraint, it's a pinned version - so we fall back to the standard tag matching in the lsRemote loop.
690
+
// * "v0.1.*"/"0.1.*", and there's a tag matching that constraint, then we find the latest matching version and return its commit hash.
691
+
// * "v0.1.*"/"0.1.*", and there is *no* tag matching that constraint, then we fall back to the standard tag matching in the lsRemote loop.
692
+
// * "custom-tag", only the lsRemote loop will run - because that revision is an invalid semver;
693
+
// * "master-branch", only the lsRemote loop will run because that revision is an invalid semver;
0 commit comments