Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix download-llvm logic for subtree sync branches #137593

Merged
merged 1 commit into from
Mar 24, 2025
Merged
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
10 changes: 9 additions & 1 deletion src/build_helper/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ pub fn get_closest_merge_commit(
// cd \"/checkout\" && \"git\" \"merge-base\" \"origin/master\" \"HEAD\"\nexpected success, got: exit status: 1\n"
// ```
// Investigate and resolve this issue instead of skipping it like this.
// NOTE (2025-03): this is probably caused by CI using a sparse checkout.
(channel == "nightly" || !CiEnv::is_rust_lang_managed_ci_job())
{
git_upstream_merge_base(config, git_dir).unwrap()
Expand All @@ -150,11 +151,18 @@ pub fn get_closest_merge_commit(
}
};

// Now that rust-lang/rust is the only repo using bors, we can search the entire
// history for a bors commit, not just "first parents". This is crucial to make
// this logic work when the user has currently checked out a subtree sync branch.
// At the same time, we use this logic in CI where only a tiny part of the history
// is even checked out, making this kind of history search very fragile. It turns
// out that by adding `--diff-merges=first-parent`, we get a usable reply
// even for sparse checkouts: it will just return the most recent bors commit.
git.args([
"rev-list",
&format!("--author={}", config.git_merge_commit_email),
"-n1",
"--first-parent",
"--diff-merges=first-parent",
Comment on lines -157 to +165
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think --diff-merges is a git show-only flag, not git rev-list.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it locally and it works for git rev-list as well.

$ git --version
git version 2.47.2

&merge_base,
]);

Expand Down
Loading