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
{{ message }}
Repository navigation
Unclear error message when remote rejects push #3079
GitHub Desktop gives the whole git log when trying to push to a protected branch, instead of simply telling the user that it is not possible to push to that protected branch.
Use a repository where one of the branches is protected, for example master. You must be the owner of the repo, and enforce protection for the administrators as well
Checkout master, make any change, commit it, and try to push
Here is the error message you get :
Expected behavior: A better error message, at least without all the git log when it was trying to push
@agisilaos these error codes live in dugite - we map specific error messages to these codes in the library. Here's the PR where we added a bunch of these messages, if you want to dig into that: desktop/dugite#76.
@Raul6469 could you attach the raw output so can incorporate that into tests? It should be in the logs: Help | Show logs in Explorer.
@shiftkey As I see the code snippet that you provided, the case regarding the issue and what is going to return is there. Not sure I understand why it isn't being caught though. Any ideas? Interesting 🤔 Also checked the error messages over at dugite.
This is us using dugite's error parsing to identify whether the stdout or stderr from the process match the known regexes for common errors. We have existing regexes for the specific GH00X errors that are reported from the server, but I think this one isn't being caught.
I think this needs to be fixed over in dugite, and here's how I'd do it:
clone desktop/dugite and npm install to ensure it all works
add a new rule in GitErrorRegexes that looks for this new error message and returns a descriptive enum about the required status check (we can figure out the words for this in the review)
update the test to check for this new enum value, so it now passes
Once that's in, we'll publish a new version of dugite and add a PR to Desktop, which will require us to handle it. That will close out this bug.
Activity
agisilaos commentedon Oct 17, 2017
I think I will continue working on improving these error messages. :) Any idea @j-f1, @shiftkey about the error message that will be suitable here?
shiftkey commentedon Oct 17, 2017
It looks like it's not being caught by our existing error handling. The work to do this is done here:
desktop/app/src/lib/git/core.ts
Lines 180 to 182 in 8824fc0
@agisilaos these error codes live in
dugite- we map specific error messages to these codes in the library. Here's the PR where we added a bunch of these messages, if you want to dig into that: desktop/dugite#76.@Raul6469 could you attach the raw output so can incorporate that into tests? It should be in the logs: Help | Show logs in Explorer.
Raul6469 commentedon Oct 17, 2017
@shiftkey Here you go ! I tried to isolate the part related to that issue. Tell me if something is missing
agisilaos commentedon Oct 18, 2017
@shiftkey As I see the code snippet that you provided, the case regarding the
issueand what is going to return is there. Not sure I understand why it isn't being caught though. Any ideas? Interesting 🤔 Also checked the error messages over at dugite.shiftkey commentedon Oct 18, 2017
@agisilaos apologies, I did miss something. Further up in
core.tswe have these lines:desktop/app/src/lib/git/core.ts
Lines 136 to 141 in 8824fc0
This is us using
dugite's error parsing to identify whether thestdoutorstderrfrom the process match the known regexes for common errors. We have existing regexes for the specificGH00Xerrors that are reported from the server, but I think this one isn't being caught.I think this needs to be fixed over in
dugite, and here's how I'd do it:desktop/dugiteandnpm installto ensure it all worksOnce that's in, we'll publish a new version of
dugiteand add a PR to Desktop, which will require us to handle it. That will close out this bug.shiftkey commentedon Oct 30, 2017
I've been getting some fixes into
dugitetoday - this has been added to desktop/dugite#143 and will be fixed when I bumpdugitein Desktop.