Skip to content

Commit 230c2c7

Browse files
committed
Generalize branch name in gh_range_diff
1 parent 3eb264b commit 230c2c7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/gh_range_diff.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ pub async fn gh_range_diff(
5757
repository: repo.to_string(),
5858
};
5959

60+
let gh_repo = ctx.github.repository(&format!("{owner}/{repo}")).await?;
61+
6062
// Determine the oldbase and get the comparison for the old diff
6163
let old = async {
6264
// We need to determine the oldbase (ie. the parent sha of all the commits of old).
@@ -73,7 +75,7 @@ pub async fn gh_range_diff(
7375
// is always correct no matter the order.
7476
let oldbase = ctx
7577
.github
76-
.compare(&issue_repo, "master", oldhead)
78+
.compare(&issue_repo, &gh_repo.default_branch, oldhead)
7779
.await
7880
.context("failed to retrive the comparison between newhead and oldhead")?
7981
.merge_base_commit
@@ -98,9 +100,9 @@ pub async fn gh_range_diff(
98100
// See the comment above on old for more details.
99101
let newbase = ctx
100102
.github
101-
.compare(&issue_repo, "master", newhead)
103+
.compare(&issue_repo, &gh_repo.default_branch, newhead)
102104
.await
103-
.context("failed to retrive the comparison between master and newhead")?
105+
.context("failed to retrive the comparison between the default branch and newhead")?
104106
.merge_base_commit
105107
.sha;
106108

0 commit comments

Comments
 (0)