Skip to content

Commit 6287749

Browse files
committed
Revert "force "HEAD" for non-CI and git_upstream_merge_base for CI environment"
This reverts commit 33ac202.
1 parent 395fb70 commit 6287749

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

src/build_helper/src/git.rs

+3-13
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
use std::path::{Path, PathBuf};
22
use std::process::{Command, Stdio};
33

4-
use crate::ci::CiEnv;
5-
64
pub struct GitConfig<'a> {
75
pub git_repository: &'a str,
86
pub nightly_branch: &'a str,
@@ -116,8 +114,8 @@ fn git_upstream_merge_base(
116114

117115
/// Searches for the nearest merge commit in the repository that also exists upstream.
118116
///
119-
/// It looks for the most recent commit made by the merge bot by matching the author's email
120-
/// address with the merge bot's email.
117+
/// If it fails to find the upstream remote, it then looks for the most recent commit made
118+
/// by the merge bot by matching the author's email address with the merge bot's email.
121119
pub fn get_closest_merge_commit(
122120
git_dir: Option<&Path>,
123121
config: &GitConfig<'_>,
@@ -129,15 +127,7 @@ pub fn get_closest_merge_commit(
129127
git.current_dir(git_dir);
130128
}
131129

132-
let merge_base = {
133-
if CiEnv::is_ci() {
134-
git_upstream_merge_base(config, git_dir).unwrap()
135-
} else {
136-
// For non-CI environments, ignore rust-lang/rust upstream as it usually gets
137-
// outdated very quickly.
138-
"HEAD".to_string()
139-
}
140-
};
130+
let merge_base = git_upstream_merge_base(config, git_dir).unwrap_or_else(|_| "HEAD".into());
141131

142132
git.args([
143133
"rev-list",

0 commit comments

Comments
 (0)