-
Notifications
You must be signed in to change notification settings - Fork 70
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
Better error messages from git push
#115
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
libgit2 and go-git both have flaws in the way they treat errors from the remote. go-git takes only the first line, meaning that it gets a blank error message from GitLab which like to respond with a banner. libgit2 returns the whole response, including blank lines and fences ("=========..."). This commit corrects for both these flaws, by supplying a message if go-git has taken a blank line, and stripping out blank lines and fences from libgit2's error. This is unavoidably a brittle approach, so I have limited it to just the situation that was reported as a problem: pushing to the upstream git repo. Signed-off-by: Michael Bridgen <[email protected]>
squaremo
force-pushed
the
better-push-message
branch
from
February 25, 2021 12:43
4cce0fc
to
86104aa
Compare
hiddeco
approved these changes
Feb 25, 2021
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.
Looks OK to me, tiny nit about a missing license header. 🍍
@@ -0,0 +1,86 @@ | |||
package controllers |
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.
Test file, but missing the LICENSE header we have everywhere.
This commit adds a handful of tests to make sure errors in the problematic formats are rewritten, and other errors are left alone. I'm reluctant to test against the actual git providers, since that would introduce a dependency on them. Thus, these tests won't guard against the providers changing their messages. Signed-off-by: Michael Bridgen <[email protected]>
squaremo
force-pushed
the
better-push-message
branch
from
February 25, 2021 14:22
86104aa
to
f0001de
Compare
hiddeco
approved these changes
Feb 25, 2021
squaremo
added a commit
to fluxcd/pkg
that referenced
this pull request
Mar 1, 2021
This adds the git error tidiers from fluxcd/image-automation-controller#115 to fluxcd/pkg/gitutil, so they can be used elsewhere e.g., in source-controller. Signed-off-by: Michael Bridgen <[email protected]>
squaremo
added a commit
to fluxcd/pkg
that referenced
this pull request
Mar 2, 2021
This adds the git error tidiers from fluxcd/image-automation-controller#115 to fluxcd/pkg/gitutil, so they can be used elsewhere e.g., in source-controller. Signed-off-by: Michael Bridgen <[email protected]>
squaremo
added a commit
to fluxcd/source-controller
that referenced
this pull request
Mar 3, 2021
In some circumstances (that are rather hard to reproduce), cloning from a GitLab repo gets a multiline response as described in fluxcd/image-automation-controller#115. This uses the same remedy as in that PR, by calling the funcs provided by fluxcd/pkg/gitutil on any error returned by libgit2 or gogit clone operations. Signed-off-by: Michael Bridgen <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
libgit2 and go-git both have flaws in the way they treat errors from the remote. go-git takes only the first line, meaning that it gets a blank error message from GitLab which like to respond with a banner. libgit2 returns the whole response, including blank lines and fences ("=========...").
This commit corrects for both these flaws, by supplying a message if go-git has taken a blank line, and stripping out blank lines and fences from libgit2's error. This is unavoidably a brittle approach, so I have limited it to just the situation that was reported as a problem: pushing to the upstream git repo.
Fixes #102.