Skip to content

git_ui: Fix create pull request for remotes with no provider - #59880

Closed
fly2xj wants to merge 1 commit into
zed-industries:mainfrom
fly2xj:fix/create-pull-request-unknown-host
Closed

git_ui: Fix create pull request for remotes with no provider#59880
fly2xj wants to merge 1 commit into
zed-industries:mainfrom
fly2xj:fix/create-pull-request-unknown-host

Conversation

@fly2xj

@fly2xj fly2xj commented Jun 25, 2026

Copy link
Copy Markdown

Summary

The post-push toast's "Create Pull Request" button regressed in #53913: it now always dispatches the git::CreatePullRequest action, which parses the remote URL through the GitHostingProviderRegistry. For remotes whose host has no registered provider (e.g. internal GitLab instances such as git.woa.com), parse_git_remote_url returns None and the button fails with:

Unsupported remote URL: git@git.woa.com:ybtm-client/dtm-harness.git

Root cause

Before #53913, the "Create Pull Request" button only appeared when git's push output contained a create-PR/MR link (e.g. GitLab's remote: To create a merge request for ..., visit: <url>), and clicking it opened that URL directly via cx.open_url(&link) — no remote-URL parsing, so it worked for any host.

#53913 changed the button to always appear and to dispatch git::CreatePullRequest, which routes through create_pull_request()git::parse_git_remote_url(). That walks Zed's hosting-provider registry, and no provider matches hosts like git.woa.com (an internal GitLab instance; GitLab's self-hosted detection requires host.contains("gitlab")). So parse_git_remote_url returns None and the error is surfaced to the user.

Fix

Restore the stderr-link path alongside the new always-show button, preferring git's own output when present:

  • remote_output.rs: re-added a PushPrLink { link } SuccessStyle variant and an extract_pull_request_link helper that scans only remote:-prefixed lines (so unrelated links such as OpenSSH's post-quantum warning are ignored). This works for any host because the server produces the URL itself.
  • git_panel.rs: when PushPrLink is produced, the "Create Pull Request" button opens that URL directly; otherwise it falls back to dispatching CreatePullRequest (the provider-based path, for known hosts without a stderr link). The ToastWithLog "View Log" fallback for non-push actions is preserved.
  • Re-added the linkify dependency to git_ui.

Testing

  • Updated the three existing push tests to assert PushPrLink with the correct extracted URLs.
  • Added test_push_internal_host_merge_request_link — a regression guard mirroring the reported git.woa.com scenario.
  • All 116 git_ui lib tests pass; ./script/clippy -p git_ui and cargo fmt are clean.

Release Notes:

  • Fixed the "Create Pull Request" button on the post-push toast failing with "Unsupported remote URL" for remotes whose host has no registered git hosting provider (e.g. internal GitLab instances).

@cla-bot

cla-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown

Thank you for your pull request and welcome to our community. We could not parse the GitHub identity of the following contributors: jannisxiong.
This is most likely caused by a git client misconfiguration; please make sure to:

  1. check if your git client is configured with an email to sign commits git config --list | grep email
  2. If not, set it up using git config --global user.email email@example.com
  3. Make sure that the git commit email is configured in your GitHub account settings, see https://github.com/settings/emails

@zed-community-bot zed-community-bot Bot added the first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions label Jun 25, 2026
The post-push toast's "Create Pull Request" button regressed in zed-industries#53913:
it now always dispatches the git::CreatePullRequest action, which parses
the remote URL through the GitHostingProviderRegistry. For remotes whose
host has no registered provider (e.g. internal GitLab instances such as
git.woa.com), parse_git_remote_url returns None and the button fails
with "Unsupported remote URL".

Restore the pre-regression path: when git's push output contains a
create/view pull/merge request link on a remote: line, open that URL
directly instead of relying on a matching provider. Fall back to the
provider-based action only when no link is present, so known hosts
without a stderr link still work.
@fly2xj
fly2xj force-pushed the fix/create-pull-request-unknown-host branch from e8a5d5d to 206e16b Compare June 25, 2026 07:35
@cla-bot

cla-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement, and we don't have @fly2xj on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@fly2xj

fly2xj commented Jun 25, 2026

Copy link
Copy Markdown
Author

@cla-bot check

@cla-bot

cla-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown

We require contributors to sign our Contributor License Agreement, and we don't have @fly2xj on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@cla-bot

cla-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown

The cla-bot has been summoned, and re-checked this pull request!

@fly2xj fly2xj closed this Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

first contribution the author's first pull request to Zed. NOTE: the label application is automated via github actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant