From 0b984b5ade7604e3f1c618c0ef77879de800b868 Mon Sep 17 00:00:00 2001 From: Brandon Chinn Date: Fri, 3 Apr 2026 08:52:17 -0500 Subject: [PATCH] Ignore user config when checking remote git URL for dev extensions (#52538) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 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 ## Self-Review Checklist - [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 --- crates/extension/src/extension_builder.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/crates/extension/src/extension_builder.rs b/crates/extension/src/extension_builder.rs index 1c204398c34728cab6b05687050243b4a988902c..f0e789994127c9347c8eb6b8d16417ba7eaaf831 100644 --- a/crates/extension/src/extension_builder.rs +++ b/crates/extension/src/extension_builder.rs @@ -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 '{}'",