Fix: Fixed crash when Git branch tip is null #12622
Merged
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.
Resolved / Related Issues
Closes Crash when opening folder with .git folder #12618
Validation
How did you test these changes?
Comment
I found that the crash is actually caused by the remote HEAD pointing to
origin/master
, which no longer exists, causing theTip
isnull
.I not sure how the remote HEAD ended up in this state since I cloned the Windows-universal-samples repository a long time ago. It might be an edge case.
Here are the steps and git commands I tested that can lead to the HEAD pointing to a non-existent branch:
git push -u origin master
git checkout -b main
git push -u origin main
main
on GitHub.git remote set-head origin master
git push origin -d master
git branch --delete master