Auto-append .git suffix for GitHub/GitLab URLs missing it#225
Merged
swissspidy merged 10 commits intomainfrom Mar 3, 2026
Merged
Auto-append .git suffix for GitHub/GitLab URLs missing it#225swissspidy merged 10 commits intomainfrom
.git suffix for GitHub/GitLab URLs missing it#225swissspidy merged 10 commits intomainfrom
Conversation
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Determine if git prefix and append .git suffix
Auto-append Mar 2, 2026
.git suffix for GitHub/GitLab URLs missing it
This comment was marked as resolved.
This comment was marked as resolved.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
swissspidy
reviewed
Mar 3, 2026
swissspidy
reviewed
Mar 3, 2026
swissspidy
reviewed
Mar 3, 2026
…st expectation Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
swissspidy
reviewed
Mar 3, 2026
swissspidy
reviewed
Mar 3, 2026
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.
wp package installonly recognized a URL as a git repository if it ended with.git, silently failing for standard GitHub/GitLab URLs without that suffix.Changes
maybe_add_git_suffix()method — normalizes GitHub/GitLab HTTPS and SSH URLs by appending.gitif absent, before any further processing. Supports nested GitLab group paths (e.g.https://gitlab.com/group/subgroup/repo).install()— runs before version suffix parsing andis_git_repository()check, so all downstream logic operates on an already-normalized URL.get_github_default_branch()is now only called for GitHub URLs; non-GitHub git repos (e.g. GitLab) default todev-masterinstead of making a failing GitHub API call.# These now work identically to their .git equivalents: wp package install https://github.com/wp-cli/google-sitemap-generator-cli wp package install https://github.com/wp-cli/google-sitemap-generator-cli:dev-main wp package install git@github.com:wp-cli/google-sitemap-generator-cli wp package install https://gitlab.com/group/subgroup/repoBoth HTTPS and SSH formats are handled for both GitHub and GitLab. Version suffixes (
:dev-main) are preserved during normalization.Tests
Added four Behat scenarios covering the new behavior:
.git).git.git.gitOriginal prompt
.gitsuffix if not there. #67💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.