Skip to content
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

Generic handling of Git exit codes, errors and warnings #6527

Closed
mstv opened this issue May 5, 2019 · 3 comments · Fixed by #9056
Closed

Generic handling of Git exit codes, errors and warnings #6527

mstv opened this issue May 5, 2019 · 3 comments · Fixed by #9056

Comments

@mstv
Copy link
Member

mstv commented May 5, 2019

Current behaviour

The exit code of Git as well as errors and warnings printed to the console by Git are not checked by every GE function.

Expected behaviour

Git command errors are not silently ignored but handled correctly.
Git warnings and errors are displayed clearly, not only as an unhandled exception.

GitCommand shall check the Git exit code and throw a GitFailException unless the calling function indicates that it will handle the exit code itself. The Exception.Message shall contain all Git error messages ("error: ...", "fatal: ...") and all Git warning messages ("warning: ...").

A GitErrorException shall be thrown with all Git error and warning messages as the Exception.Message. These exceptions shall be caught by the calling function or form if applicable and as a fallback by GitModuleForm/GitModuleControl, which shall display the error message in a MessageBox.

GitCommand shall check for Git warning messages and display them in a MessageBox unless the calling function indicates that it will handle them itself.
Though I am not sure whether a MessageBox is really feasible in async and background tasks. If not, a GitWarningException should be thrown with all Git warning messages as the Exception.Message. The drawback of this exception would be that all functions which don't handle the warnings themselves would be canceled.

Git errors and warnings shall be logged in the GitCommandLog.

Environment

  • Git Extensions 3.1.0
  • Build 3d5da22
  • Git 2.21.0.windows.1
  • Microsoft Windows NT 6.1.7601 Service Pack 1
  • .NET Framework 4.7.2117.0
  • DPI 96dpi (no scaling)
@RussKie
Copy link
Member

RussKie commented May 17, 2019

Any thoughts on how this would look like?

@mstv
Copy link
Member Author

mstv commented Jan 9, 2020

With the display of git errors, #7607 wouldn't have failed silently.
After a crash of my PC, Reset all changes failed silently; but at least Reset file or directory changes displayed the good hint below.
I'd prefer a MessageBox with the buttons Ignore and Abort. On Abort, the GitException shall be (re)thrown.
grafik

@gerhardol
Copy link
Member

A little more info in #8735

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants