force default branch name for tests#2393
Merged
asottile merged 1 commit intopre-commit:mainfrom May 15, 2022
Merged
Conversation
asottile
reviewed
May 14, 2022
testing/fixtures.py
Outdated
Comment on lines
+42
to
+45
| try: | ||
| cmd_output('git', 'init', '--initial-branch=master', path) | ||
| except CalledProcessError: # pragma: no cover (pre 2.28 git) | ||
| cmd_output('git', 'init', path) |
Member
There was a problem hiding this comment.
without needing special version-specific coverage:
git -c init.defaultBranch=master init path
Contributor
Author
There was a problem hiding this comment.
OK, didn't realize that worked. I'll fix that when I'm back from running a few errands. Thanks!
| @@ -0,0 +1,8 @@ | |||
| import sys | |||
Contributor
Author
There was a problem hiding this comment.
Shoot. I thought I'd fixed that.... Will do.
75be086 to
d132c51
Compare
d132c51 to
0d55dff
Compare
Contributor
Author
|
basically a one-line patch at this point. |
0d55dff to
34e9702
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Fixes #2391
More modern git versions have the ability to set the default branch name, and recent documentation warns against expecting the branch name to be stable. As such, added an explicit set to
master(as that was the minimal change and is backwards compatible with older versions of git.Call is made in a try/except block checking for errors and stepping back to the previous version without initial-branch