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

Fix: Fixed crash when Git branch tip is null #12622

Merged
merged 1 commit into from
Jun 15, 2023

Conversation

tanchekwei
Copy link
Contributor

Resolved / Related Issues

  • Were these changes approved in an issue or discussion with the project maintainers? In order to prevent extra work, feature requests and changes to the codebase must be approved before the pull request will be reviewed. This prevents extra work for the contributors and maintainers.
    Closes Crash when opening folder with .git folder #12618

Validation
How did you test these changes?

  • Did you build the app and test your changes?
  • Did you check for accessibility? You can use Accessibility Insights for this.
  • Did you remove any strings from the en-us resource file?
    • Did you search the solution to see if the string is still being used?
  • Did you implement any design changes to an existing feature?
    • Was this change approved?
  • Are there any other steps that were used to validate these changes?
    1. Open app ...
    2. Click settings button ...

Comment

I found that the crash is actually caused by the remote HEAD pointing to origin/master, which no longer exists, causing the Tip is null.

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:

  1. Create a new repository
  2. Clone the repository
  3. Make changes and commit them
  4. git push -u origin master
  5. git checkout -b main
  6. git push -u origin main
  7. Update the default branch to main on GitHub.
  8. git remote set-head origin master
  9. git push origin -d master
  10. git branch --delete master

image
image

@yaira2 yaira2 changed the title Fix: Fix crash when branch tip is null Fix: Fixed crash when branch tip is null Jun 15, 2023
Copy link
Member

@yaira2 yaira2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the detailed analysis and the fix. LGTM

@yaira2 yaira2 added ready to merge Pull requests that are approved and ready to merge and removed needs - code review labels Jun 15, 2023
@yaira2 yaira2 changed the title Fix: Fixed crash when branch tip is null Fix: Fixed crash that wouold occur when Git branch tip is null Jun 15, 2023
@yaira2 yaira2 changed the title Fix: Fixed crash that wouold occur when Git branch tip is null Fix: Fixed crash when Git branch tip is null Jun 15, 2023
@yaira2 yaira2 merged commit 8293169 into files-community:main Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Pull requests that are approved and ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash when opening folder with .git folder
2 participants