Skip to content

Commit df004df

Browse files
Re-download LLVM on submodule updates only
1 parent 8b40853 commit df004df

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/bootstrap/bootstrap.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,19 @@ def download_stage0(self):
424424
rustfmt_stamp.write(self.date + self.rustfmt_channel)
425425

426426
if self.downloading_llvm():
427-
llvm_sha = subprocess.check_output(["git", "log", "--author=bors",
428-
"--format=%H", "-n1"]).decode(sys.getdefaultencoding()).strip()
427+
# We want the most recent LLVM submodule update to avoid downloading
428+
# LLVM more often than necessary.
429+
#
430+
# This git command finds that commit SHA, looking for bors-authored
431+
# merges that modified src/llvm-project.
432+
#
433+
# This works even in a repository that has not yet initialized
434+
# submodules.
435+
llvm_sha = subprocess.check_output([
436+
"git", "log", "--author=bors", "--format=%H", "-n1",
437+
"-m", "--first-parent",
438+
"--", "src/llvm-project"
439+
]).decode(sys.getdefaultencoding()).strip()
429440
llvm_assertions = self.get_toml('assertions', 'llvm') == 'true'
430441
if self.program_out_of_date(self.llvm_stamp(), llvm_sha + str(llvm_assertions)):
431442
self._download_ci_llvm(llvm_sha, llvm_assertions)

0 commit comments

Comments
 (0)