Skip to content

Commit 101e593

Browse files
authored
Rollup merge of #72993 - cuviper:beta-number, r=Mark-Simulacrum
Count the beta prerelease number just from master We were computing a merge-base between the remote beta and master branches, but this was giving incorrect answers for the first beta if the remote hadn't been pushed yet. For instance, `1.45.0-beta.3359` corresponds to the number of merges since the 1.44 beta, but we really want just `.1` for the sole 1.45 beta promotion merge. We don't really need to query the remote beta at all -- `master..HEAD` suffices if we assume that we're on the intended beta branch already.
2 parents 6f8760b + 37a24b3 commit 101e593

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

src/bootstrap/lib.rs

+4-18
Original file line numberDiff line numberDiff line change
@@ -963,29 +963,15 @@ impl Build {
963963
return s;
964964
}
965965

966-
let beta = output(
967-
Command::new("git").arg("ls-remote").arg("origin").arg("beta").current_dir(&self.src),
968-
);
969-
let beta = beta.trim().split_whitespace().next().unwrap();
970-
let master = output(
971-
Command::new("git").arg("ls-remote").arg("origin").arg("master").current_dir(&self.src),
972-
);
973-
let master = master.trim().split_whitespace().next().unwrap();
974-
975-
// Figure out where the current beta branch started.
976-
let base = output(
977-
Command::new("git").arg("merge-base").arg(beta).arg(master).current_dir(&self.src),
978-
);
979-
let base = base.trim();
980-
981-
// Next figure out how many merge commits happened since we branched off
982-
// beta. That's our beta number!
966+
// Figure out how many merge commits happened since we branched off master.
967+
// That's our beta number!
968+
// (Note that we use a `..` range, not the `...` symmetric difference.)
983969
let count = output(
984970
Command::new("git")
985971
.arg("rev-list")
986972
.arg("--count")
987973
.arg("--merges")
988-
.arg(format!("{}...HEAD", base))
974+
.arg("refs/remotes/origin/master..HEAD")
989975
.current_dir(&self.src),
990976
);
991977
let n = count.trim().parse().unwrap();

0 commit comments

Comments
 (0)