-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor git version functions and check compatibility #29155
Conversation
d0150b8
to
4789e2e
Compare
return gitVersion, err | ||
// version string is like: "git version 2.29.3" or "git version 2.29.3.windows.1" | ||
versionString := fields[2] | ||
if pos := strings.Index(versionString, "windows"); pos >= 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
>= 1
? Not >= 0
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
>= 1
, because there is versionString[:pos-1]
below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we could use >= 0
and :pos
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, the -1 is needed for the prefix and therefore i
must be >=1
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems rather time-critical to get out.
Co-authored-by: delvh <[email protected]>
Thank you for reviewing and approving. The backport is done manually : #29157 There is a slight difference in the backport, to try the best to avoid breaking a stable release: bypass the GIT_FLUSH bug there. Feel free to edit the PR directly if you feel that it shouldn't be done. |
Introduce a new function checkGitVersionCompatibility, when the git version can't be used by Gitea, tell the end users to downgrade or upgrade. The refactored functions are related to make the code easier to test. And simplify the comments for "safe.directory" --------- Co-authored-by: delvh <[email protected]>
Introduce a new function checkGitVersionCompatibility, when the git version can't be used by Gitea, tell the end users to downgrade or upgrade. The refactored functions are related to make the code easier to test. And simplify the comments for "safe.directory" --------- Co-authored-by: delvh <[email protected]>
Automatically locked because of our CONTRIBUTING guidelines |
Introduce a new function checkGitVersionCompatibility, when the git version can't be used by Gitea, tell the end users to downgrade or upgrade. The refactored functions are related to make the code easier to test.
And simplify the comments for "safe.directory"