Skip to content

update_checkout (tests): Use 'main' for test branch #40129

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

Merged
merged 2 commits into from
Nov 12, 2021
Merged

update_checkout (tests): Use 'main' for test branch #40129

merged 2 commits into from
Nov 12, 2021

Conversation

jorng
Copy link
Contributor

@jorng jorng commented Nov 10, 2021

This updates the tests for utils/update_checkout to use main for the test branch names in git (as opposed to master). In addition to following current best practices for inclusive terms, this also fixes an issue that occurs if a user has customized their local git config to use an alternate default branch name (using init.defaultBranch).

If a user has set init.defaultBranch in their git config to anything other than master, the tests fail. By updating the git init call to use --initial-branch=main, the user's setting will not affect the test.

@jorng jorng requested a review from gottesmm November 10, 2021 21:47
@jorng
Copy link
Contributor Author

jorng commented Nov 10, 2021

@swift-ci Please smoke test

@jorng jorng requested review from shahmishal and compnerd November 10, 2021 22:21
Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

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

This is good, but please do check with @shahmishal that this shouldn't cause any unintentional issues.

@jorng
Copy link
Contributor Author

jorng commented Nov 11, 2021

@swift-ci Please smoke test

@jorng
Copy link
Contributor Author

jorng commented Nov 11, 2021

As far as I can tell, it looks like the --initial-branch=main option is not working for the git init --bare call. Perhaps the test environments don't have a new enough version of git?

I've updated this to use git symbolic-ref HEAD refs/heads/main, which should be more compatible.

@swift-ci Please smoke test

Copy link

@jambestwick jambestwick left a comment

Choose a reason for hiding this comment

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

change main to master

In addition to following current best practices for inclusive terms,
this also fixes an issue that occurs if a user has customized their
local git config to use an alternate default branch name (using
'init.defaultBranch').

If a user has set 'init.defaultBranch' in their git config to anything
other than master, the update_checkout tests fail. By setting the
sybolic-ref for HEAD after initializing the bare repo, the user's
setting will not affect the test.
If 'call_quietly' fails, there is no indication as to what the failure
was, except for the exit/status code from the subprocess. This adds a
new exception type that will print out stdout/stderr from the subprocess
@jorng
Copy link
Contributor Author

jorng commented Nov 11, 2021

OK, one more try here. It still doesn't seem to be respecting the main branch name in the "local" repo. Added the symbolic-ref call to the local repo too. Let's see if that does the trick.

@swift-ci Please smoke test

@jorng
Copy link
Contributor Author

jorng commented Nov 11, 2021

@swift-ci Please smoke test Linux

@jorng
Copy link
Contributor Author

jorng commented Nov 12, 2021

@shahmishal any opposition to merging this?

@shahmishal
Copy link
Member

LGTM, merged

@shahmishal shahmishal merged commit eb77eaa into swiftlang:main Nov 12, 2021
@jorng jorng deleted the fix_update_checkout_tests branch November 12, 2021 16:54
@AnthonyLatsis AnthonyLatsis added the update-checkout Area → utils: the `update-checkout` script label Sep 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
update-checkout Area → utils: the `update-checkout` script
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants