-
Notifications
You must be signed in to change notification settings - Fork 149
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
Add additional regex pattern for HostDown error code #308
Add additional regex pattern for HostDown error code #308
Conversation
An error in GitHub Desktop was being thrown that was not being appropriately parsed. In order to properly catch it a new regular expression pattern has been added.
An exra regular expression pattern was added to detect a Git.HostDown error. In order to make sure it is parsing correctly a test has been added.
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.
Just one thing to ensure the test handles what Git emits
test/fast/git-process-test.ts
Outdated
@@ -423,5 +423,12 @@ mark them as resolved using git add` | |||
const error = GitProcess.parseError(stderr) | |||
expect(error).toBe(GitError.UnresolvedConflicts) | |||
}) | |||
|
|||
it('can parse the could not resolve host error', () => { | |||
const stderr = `"Cloning into '/cloneablepath/'... fatal: unable to access 'https://github.com/Daniel-McCarthy/dugite.git/': Could not resolve host: github.com"` |
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.
Are you able to include the newline characters in this stderr
output so we can confirm the regex is working as expected?
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.
Ah yes, good catch! I have updated both as appropriate.
Previously the test and regex were missing the "↵" newline characters where appropriate. They have been added to match the original error's placement of new line characters.
…r newline Previously a commit was added to properly handle newline characters. The characters used however are not newline escape characters. They have been updated to fix the previous issue.
Because this is an additive regex I'm fine to leave it as-is. |
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 is pretty close to merging. One suggestion to relax the new regex...
Detecting the final newline character is not essential for the match to be made, therefore we can safely remove it. Co-Authored-By: Daniel-McCarthy <dan.willy.mccarthy@gmail.com>
|
@shiftkey That's awesome, thank you! I will definitely be keeping that in mind. |
This pull request is made to assist Desktop's Issue #926 by adding a regex pattern to detect a cloning failure error. Currently the error is not being parsed due to not having a pattern that matches to it. The error in question occurs when attempting to clone a repository with no available internet connection.
The exact error to be detected is:
"Cloning into '/home/hellokitty/Documents/GitHub/Chixel'... fatal: unable to access 'https://github.com/Daniel-McCarthy/Chixel.git/': Could not resolve host: github.com"
In a comment it was suggested that this regular expression pattern should be added to target the same error type
HostDown
that is being used by a currently existing regex pattern. I have added a test to go along with checking the new regular expression pattern is parsing properly. However, I noticed there was not already one in place for the originalHostDown
error regex. I could add a test to go along with the original pattern as well in this pull request.