Cherry-picking/Rebase: error softly when unexpected null state exists #13889
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.
Description
TLDR; We get to an unexpected null state in cherry-picking/rebase and that crashes the app (so far unreproducible and uncommon). This pr aims to error out more gracefully. The app should be returned to a usable non-cherry-picking/rebase state.
We have received errors indicating the application is crashing because the application is attempting to update the multiCommitOperation state when that state is null. We have received this error for rebase and cherry-picking. We have been unable to reproduce these errors.
This PR aims to prevent the application from crashing and to silently send us the error along with a slight bit more data to confirm where in the progress this is happening. My assumption is that this should be safe and not leave the user in a bad application state, because, if the multiCommitOperationState is null, that would indicate that somehow the user already reached the end of the operation and the app should return to a base non rebase/cherry-pick state.
Looking at the line numbers, it would seem that it is the progress callback from the git operations firing after the multi commit operation has been set to null. My best guess is that a user is jumping between Desktop and command line to complete the rebase or cherry-pick and the app is moving between detecting state and working through the state? Other possible scenarios are some combination of error at the same time as the callback fires as we clear the state on errors. Either way seems like a timing/combination of things problem and is why it is difficult to pin point/reproduce.
Release notes
Notes: [Fixed] App no longer crashes sometimes when rebasing and cherry-picking.