Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/post-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
sleep 60

# Get closest bors merge commit
PARENT_COMMIT=`git rev-list --author='bors <bors@rust-lang.org>' -n1 --first-parent HEAD^1`
PARENT_COMMIT=`git rev-list --author='122020455+rust-bors\[bot\]@users.noreply.github.com' -n1 --first-parent HEAD^1`
echo "Parent: ${PARENT_COMMIT}"

# Find PR for the current commit
Expand Down
24 changes: 22 additions & 2 deletions src/build_helper/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,14 @@ pub fn has_changed_since(git_dir: &Path, base: &str, paths: &[&str]) -> bool {
})
}

const LEGACY_BORS_EMAIL: &str = "bors@rust-lang.org";

/// Escape characters from the git user e-mail, so that git commands do not interpret it as regex
/// special characters.
fn escape_email_git_regex(text: &str) -> String {
text.replace("[", "\\[").replace("]", "\\]").replace(".", "\\.")
}

/// Returns the latest upstream commit that modified `target_paths`, or `None` if no such commit
/// was found.
fn get_latest_upstream_commit_that_modified_files(
Expand Down Expand Up @@ -182,9 +190,15 @@ fn get_latest_upstream_commit_that_modified_files(
"-n1",
&upstream,
"--author",
git_config.git_merge_commit_email,
&escape_email_git_regex(git_config.git_merge_commit_email),
]);

// Also search for legacy bors account, before we accrue enough commits to
// have changes to all relevant file paths done by new bors.
if git_config.git_merge_commit_email != LEGACY_BORS_EMAIL {
git.args(["--author", LEGACY_BORS_EMAIL]);
}

if !target_paths.is_empty() {
git.arg("--").args(target_paths);
}
Expand Down Expand Up @@ -229,11 +243,17 @@ pub fn get_closest_upstream_commit(
git.args([
"rev-list",
"--author-date-order",
&format!("--author={}", config.git_merge_commit_email),
&format!("--author={}", &escape_email_git_regex(config.git_merge_commit_email),),
"-n1",
base,
]);

// Also search for legacy bors account, before we accrue enough commits to
// have changes to all relevant file paths done by new bors.
if config.git_merge_commit_email != LEGACY_BORS_EMAIL {
git.args(["--author", LEGACY_BORS_EMAIL]);
}

let output = output_result(&mut git)?.trim().to_owned();
if output.is_empty() { Ok(None) } else { Ok(Some(output)) }
}
Expand Down
11 changes: 0 additions & 11 deletions src/ci/docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -312,16 +312,6 @@ else
command=(/checkout/src/ci/run.sh)
fi

if isCI; then
# Get some needed information for $BASE_COMMIT
#
# This command gets the last merge commit which we'll use as base to list
# deleted files since then.
BASE_COMMIT="$(git log --author=bors@rust-lang.org -n 2 --pretty=format:%H | tail -n 1)"
else
BASE_COMMIT=""
fi

SUMMARY_FILE=github-summary.md
touch $objdir/${SUMMARY_FILE}

Expand Down Expand Up @@ -359,7 +349,6 @@ docker \
--env RUST_CI_OVERRIDE_RELEASE_CHANNEL \
--env CI_JOB_NAME="${CI_JOB_NAME-$image}" \
--env CI_JOB_DOC_URL="${CI_JOB_DOC_URL}" \
--env BASE_COMMIT="$BASE_COMMIT" \
--env DIST_TRY_BUILD \
--env PR_CI_JOB \
--env OBJDIR_ON_HOST="$objdir" \
Expand Down
2 changes: 1 addition & 1 deletion src/stage0
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
dist_server=https://static.rust-lang.org
artifacts_server=https://ci-artifacts.rust-lang.org/rustc-builds
artifacts_with_llvm_assertions_server=https://ci-artifacts.rust-lang.org/rustc-builds-alt
git_merge_commit_email=bors@rust-lang.org
git_merge_commit_email=122020455+rust-bors[bot]@users.noreply.github.com
nightly_branch=main

# The configuration above this comment is editable, and can be changed
Expand Down
Loading