From cd420009d4628db8a6e88fc855c34deea05a1ed2 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Wed, 10 Sep 2025 16:54:41 +0200 Subject: [PATCH 1/2] feat(vcs): Prefer upstream remote over origin for base repo name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When determining the base repository name, now prioritizes: 1. upstream (if exists) 2. origin (if exists) 3. first available remote This follows Git conventions where upstream typically refers to the original repository when working with forks. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/utils/vcs.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/utils/vcs.rs b/src/utils/vcs.rs index f1d92f05a5..5b52ef3c79 100644 --- a/src/utils/vcs.rs +++ b/src/utils/vcs.rs @@ -295,8 +295,10 @@ pub fn git_repo_base_repo_name(repo: &git2::Repository) -> Result return Ok(None); } - // Prefer "origin" remote if it exists, otherwise use the first one - let chosen_remote = if remote_names.contains(&"origin") { + // Prefer "upstream" if it exists, then "origin", otherwise use the first one + let chosen_remote = if remote_names.contains(&"upstream") { + "upstream" + } else if remote_names.contains(&"origin") { "origin" } else { remote_names[0] From f832638b054ae0442c23e1fc1ca410e599095642 Mon Sep 17 00:00:00 2001 From: Nelson Osacky Date: Fri, 12 Sep 2025 09:14:18 +0200 Subject: [PATCH 2/2] docs: Update git_repo_base_repo_name doc comment to reflect upstream preference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update function documentation to correctly reflect that we now prefer "upstream" remote first, then "origin", then first available remote. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/utils/vcs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/vcs.rs b/src/utils/vcs.rs index 5b52ef3c79..2ec789f0e4 100644 --- a/src/utils/vcs.rs +++ b/src/utils/vcs.rs @@ -284,7 +284,7 @@ fn find_merge_base_ref( } /// Attempts to get the base repository name from git remotes. -/// Prefers "origin" remote if it exists, otherwise uses the first available remote. +/// Prefers "upstream" remote if it exists, then "origin", otherwise uses the first available remote. /// Returns the base repository name if a remote is found. pub fn git_repo_base_repo_name(repo: &git2::Repository) -> Result> { let remotes = repo.remotes()?;