Skip to content

Commit 8b6f5df

Browse files
runningcodeclaude
andcommitted
fix: Simplify return types from Result<Option<String>> to Result<String>
The git_repo_base_ref and find_merge_base_ref functions never return Ok(None), so simplified return types and removed unreachable code paths. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 1b74949 commit 8b6f5df

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/commands/build/upload.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,10 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
177177
// This attempts to find the merge-base with the remote tracking branch
178178
repo_ref
179179
.and_then(|r| match git_repo_base_ref(r, &cached_remote) {
180-
Ok(Some(base_ref_name)) => {
180+
Ok(base_ref_name) => {
181181
debug!("Found base reference: {}", base_ref_name);
182182
Some(base_ref_name)
183183
}
184-
Ok(None) => {
185-
warn!("No base reference found (could not determine merge-base)");
186-
None
187-
}
188184
Err(e) => {
189185
warn!("Could not detect base branch reference: {}", e);
190186
None

src/utils/vcs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ pub fn git_repo_head_ref(repo: &git2::Repository) -> Result<String> {
249249
}
250250
}
251251

252-
pub fn git_repo_base_ref(repo: &git2::Repository, remote_name: &str) -> Result<Option<String>> {
252+
pub fn git_repo_base_ref(repo: &git2::Repository, remote_name: &str) -> Result<String> {
253253
// Get the current HEAD commit
254254
let head_commit = repo.head()?.peel_to_commit()?;
255255

@@ -270,7 +270,7 @@ fn find_merge_base_ref(
270270
repo: &git2::Repository,
271271
head_commit: &git2::Commit,
272272
remote_ref: &git2::Reference,
273-
) -> Result<Option<String>> {
273+
) -> Result<String> {
274274
let remote_commit = remote_ref.peel_to_commit()?;
275275
let merge_base_oid = repo.merge_base(head_commit.id(), remote_commit.id())?;
276276

@@ -280,7 +280,7 @@ fn find_merge_base_ref(
280280
"Found merge-base commit as base reference: {}",
281281
merge_base_sha
282282
);
283-
Ok(Some(merge_base_sha))
283+
Ok(merge_base_sha)
284284
}
285285

286286
fn find_reference_url(repo: &str, repos: &[Repo]) -> Result<Option<String>> {

0 commit comments

Comments
 (0)