fix download-llvm logic for subtree sync branches · rust-lang/rust@0ee9456 (original) (raw)

`@@ -140,6 +140,7 @@ pub fn get_closest_merge_commit(

`

140

140

`// cd "/checkout" && "git" "merge-base" "origin/master" "HEAD"\nexpected success, got: exit status: 1\n"

`

141

141

```` // ```

````

142

142

`// Investigate and resolve this issue instead of skipping it like this.

`

``

143

`+

// NOTE (2025-03): this is probably caused by CI using a sparse checkout.

`

143

144

`(channel == "nightly" || !CiEnv::is_rust_lang_managed_ci_job())

`

144

145

`{

`

145

146

`git_upstream_merge_base(config, git_dir).unwrap()

`

`@@ -150,11 +151,18 @@ pub fn get_closest_merge_commit(

`

150

151

`}

`

151

152

`};

`

152

153

``

``

154

`+

// Now that rust-lang/rust is the only repo using bors, we can search the entire

`

``

155

`+

// history for a bors commit, not just "first parents". This is crucial to make

`

``

156

`+

// this logic work when the user has currently checked out a subtree sync branch.

`

``

157

`+

// At the same time, we use this logic in CI where only a tiny part of the history

`

``

158

`+

// is even checked out, making this kind of history search very fragile. It turns

`

``

159

`` +

// out that by adding --diff-merges=first-parent, we get a usable reply

``

``

160

`+

// even for sparse checkouts: it will just return the most recent bors commit.

`

153

161

` git.args([

`

154

162

`"rev-list",

`

155

163

`&format!("--author={}", config.git_merge_commit_email),

`

156

164

`"-n1",

`

157

``

`-

"--first-parent",

`

``

165

`+

"--diff-merges=first-parent",

`

158

166

`&merge_base,

`

159

167

`]);

`

160

168

``