-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Remove explicit git branch fallbacks for wp-env and update readme #41043
Conversation
Size Change: 0 B Total Size: 1.24 MB ℹ️ View Unchanged
|
gitHubFields[ 1 ] === 'WordPress' | ||
) { | ||
gitHubFields[ 5 ] = | ||
gitHubFields[ 2 ] === 'WordPress' ? 'master' : 'trunk'; |
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.
Essentially, every WordPress org repo except the WordPress
repository gets trunk
as default? Seems fair enough, though I imagine there are more edge cases. It probably doesn't make sense to cover all of them :)
Unless there's a way to use the GitHub API to easily figure out a remote repo's primary branch?
Actually, having said that, doesn't git clone https://github.com/WordPress/gutenberg.git
automatically use the correct base branch? I wonder if it'd then be possible to avoid setting a ref whatsoever if none is given. Then we don't have to worry about base branches at all.
The only concern is that I don't know if the git wrapper handles that.
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.
Actually, having said that, doesn't git clone https://github.com/WordPress/gutenberg.git automatically use the correct base branch
Ah, that would be a better approach, will give it a try tomorrow and see if the wrapper does handle it or not.
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.
@noahtallen, it seems to work to not specify a fallback and just let git fall back to the repos default branch 🎉
Now that #40451 is merged, there might be another bit of code that needs to be adjusted to work with this |
954595a
to
a5bc96f
Compare
@@ -133,7 +133,7 @@ function parseSourceString( sourceString, { workDirectoryPath } ) { | |||
return { | |||
type: 'git', | |||
url: sshUrl.href.split( '#' )[ 0 ], | |||
ref: sshUrl.hash.slice( 1 ) || 'master', | |||
ref: sshUrl.hash.slice( 1 ) || undefined, |
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.
Ends up as an empty string here if undefined not specified
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.
LGTM 👍
We might want to update the PR title too though 🙂
True, thanks for the review, have updated the title. |
894edba
to
59c757e
Compare
What?
Updates reference to
master
branch in wp-env to instead use eithertrunk
ormain
depending on context.Why?
Fixes: #40928
Github now defaults to
main
. Gutenberg istrunk
and WordPress/WordPress is still tomaster
though, so these are accounted for separatelyHow?
Renamed branches where appropriate
Testing Instructions
npm run wp-env start
and make sure environment starts as expectedwpengine/atlas-content-modeler
to the plugins section of.wp-env.json
and restart env and make sure this plugin loads as expected - this plugin repo usesmain
as default branch