Ignore user config when checking remote git URL for dev extensions (#52538)

## Context

Fixes #48163

Also update the logic from `git remote -v` + manually parse => `git
remote get-url origin`

Not sure the best way to test this

## How to Review

<!-- Help reviewers focus their attention:
- For small PRs: note what to focus on (e.g., "error handling in
foo.rs")
- For large PRs (>400 LOC): provide a guided tour — numbered list of
files/commits to read in order. (The `large-pr` label is applied
automatically.)
     - See the review process guidelines for comment conventions -->

## Self-Review Checklist

<!-- Check before requesting review: -->
- [x] I've reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the [UI/UX
checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist)
- [ ] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable

Release Notes:

- Fixed rebuilding dev extensions when user git config contains url
rewriting rules
This commit is contained in:
Brandon Chinn 2026-04-03 08:52:17 -05:00 committed by GitHub
parent 90fcf8539e
commit 0b984b5ade
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -296,16 +296,12 @@ impl ExtensionBuilder {
let remotes_output = util::command::new_command("git")
.arg("--git-dir")
.arg(&git_dir)
.args(["remote", "-v"])
.args(["remote", "get-url", "origin"])
.env("GIT_CONFIG_GLOBAL", "/dev/null")
.output()
.await?;
let has_remote = remotes_output.status.success()
&& String::from_utf8_lossy(&remotes_output.stdout)
.lines()
.any(|line| {
let mut parts = line.split(|c: char| c.is_whitespace());
parts.next() == Some("origin") && parts.any(|part| part == url)
});
&& String::from_utf8_lossy(&remotes_output.stdout).trim() == url;
if !has_remote {
bail!(
"grammar directory '{}' already exists, but is not a git clone of '{}'",