Skip to content

Commit 1c7fcdc

Browse files
Update src/utils/vcs.rs
Co-authored-by: Daniel Szoke <7881302+szokeasaurusrex@users.noreply.github.com>
1 parent 5f3ab77 commit 1c7fcdc

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/utils/vcs.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -588,11 +588,12 @@ pub fn find_base_sha(remote_name: &str) -> Result<Option<String>> {
588588
.find_reference(&remote_branch_name)
589589
.with_context(|| "Could not find default branch for {remote_name}")?;
590590

591-
let remote_commit = remote_ref.peel_to_commit()?;
592-
let merge_base_oid = repo.merge_base(head_commit.id(), remote_commit.id())?;
593-
let merge_base_sha = merge_base_oid.to_string();
594-
debug!("Found merge-base commit as base reference: {merge_base_sha}");
595-
Ok(Some(merge_base_sha))
591+
Ok(remote_ref
592+
.peel_to_commit()
593+
.and_then(|remote_commit| repo.merge_base(head_commit.id(), remote_commit.id()))
594+
.map(|oid| oid.to_string())
595+
.ok()
596+
.inspect(|sha| debug!("Found merge-base commit as base reference: {sha}")))
596597
}
597598

598599
/// Extracts the PR head SHA from GitHub Actions event payload JSON.

0 commit comments

Comments
 (0)