Skip to content

Conversation

@schlessera
Copy link
Member

This PR adds logic to the wp package install command so that it tries to retrieve the default branch of a GitHub repository if no version was provided, instead of using the hard-coded master branch as a default.

Comment on lines +1411 to +1416
"Couldn't fetch default branch for package '%s' (HTTP code %d). Presuming default branch is 'master'.",
$package_name,
$response->status_code
)
);
return 'master';
Copy link
Member

Choose a reason for hiding this comment

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

AFAIK nowadays the default branch for new repositories on GitHub is main, but I suppose that it might still be master for older ones that haven't switched.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I'm keeping the master for now as GitHub and Composer seem to keep aliases around for BC. This can still be changed at a later date.

@schlessera schlessera added this to the 2.2.0 milestone Jan 10, 2022
@schlessera schlessera merged commit 8eb34dc into main Jan 10, 2022
@schlessera schlessera deleted the fix/fetch-default-branch-for-github branch January 10, 2022 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants