summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-07-13 05:24:18 +0000
committerbors <bors@rust-lang.org>2022-07-13 05:24:18 +0000
commit95e8b86c8c0aba65b2b0065265ce6d82d5a2c285 (patch)
tree9ac870bba91f79f5e4f3b34e2d7f3c59bb452080 /src/bootstrap
parent7b5715289f813460ac95189fb7d3479e8edd23eb (diff)
parent6bc97d0adcc7e9bd828de1ccf9c9ffc9b30165ee (diff)
downloadrust-95e8b86c8c0aba65b2b0065265ce6d82d5a2c285.tar.gz
rust-95e8b86c8c0aba65b2b0065265ce6d82d5a2c285.zip
Auto merge of #99149 - ferrocene:pa-nightly-branch, r=Mark-Simulacrum
Configure nightly branch name in `stage0.json`

The beta version number detection code relies on git to know how many merge commits were made since we branched off, and in doing so hardcodes `master` as the default branch name. This works for rust-lang/rust, but is problematic for forks that use a different default branch name (in Ferrocene we use `main` instead).

This PR changes the code to instead load the default branch name from `src/stage0.json`. `bump-stage0` has also been updated to remove the need to update it every time a new field is added to `stage0.json`.
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/config.rs1
-rw-r--r--src/bootstrap/lib.rs13
2 files changed, 6 insertions, 8 deletions
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index 39d86ccbdbf..62dd9a6b365 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -226,6 +226,7 @@ pub struct Stage0Config {
     pub artifacts_server: String,
     pub artifacts_with_llvm_assertions_server: String,
     pub git_merge_commit_email: String,
+    pub nightly_branch: String,
 }
 #[derive(Default, Deserialize)]
 #[cfg_attr(test, derive(Clone))]
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index c1190c9192d..cd421c249d8 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -1280,14 +1280,11 @@ impl Build {
         // Figure out how many merge commits happened since we branched off master.
         // That's our beta number!
         // (Note that we use a `..` range, not the `...` symmetric difference.)
-        let count = output(
-            self.config
-                .git()
-                .arg("rev-list")
-                .arg("--count")
-                .arg("--merges")
-                .arg("refs/remotes/origin/master..HEAD"),
-        );
+        let count =
+            output(self.config.git().arg("rev-list").arg("--count").arg("--merges").arg(format!(
+                "refs/remotes/origin/{}..HEAD",
+                self.config.stage0_metadata.config.nightly_branch
+            )));
         let n = count.trim().parse().unwrap();
         self.prerelease_version.set(Some(n));
         n