-
-
Notifications
You must be signed in to change notification settings - Fork 804
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
force default branch name for tests #2393
force default branch name for tests #2393
Conversation
testing/fixtures.py
Outdated
try: | ||
cmd_output('git', 'init', '--initial-branch=master', path) | ||
except CalledProcessError: # pragma: no cover (pre 2.28 git) | ||
cmd_output('git', 'init', path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
without needing special version-specific coverage:
git -c init.defaultBranch=master init path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, don't run git add .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shoot. I thought I'd fixed that.... Will do.
75be086
to
d132c51
Compare
d132c51
to
0d55dff
Compare
basically a one-line patch at this point. |
0d55dff
to
34e9702
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(cherry picked from commit 34e9702) Reference: pre-commit/pre-commit@34e9702 Reference: pre-commit/pre-commit#2393 Signed-off-by: Luís Ferreira <contact@lsferreira.net>
(cherry picked from commit 34e9702) Reference: pre-commit/pre-commit@34e9702 Reference: pre-commit/pre-commit#2393 Signed-off-by: Luís Ferreira <contact@lsferreira.net>
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