perf(git_status): avoid running in bare repos #5581
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.
Description
This change adjusts the git_status module to no longer attempt to generate git_status for a bare repository as this is not possible when a repository does not have a work tree.
Motivation and Context
Currently entering a bare repository throws an error, as described in the associated issue.
Closes #5544
Screenshots (if appropriate):
When entering a bare repository the error is no longer visible:
How Has This Been Tested?
Locally by entering a bare repository as per the above screenshot.
You can also see the correct behaviour from the unit test output (I believe I've used the fixture correctly although not familiar with the setup):
Checklist: