about summary refs log tree commit diff
path: root/src/build_helper
diff options
context:
space:
mode:
authorJakub Beránek <berykubik@gmail.com>2025-03-21 22:23:37 +0100
committerJakub Beránek <berykubik@gmail.com>2025-04-20 09:13:55 +0200
commit0396f0e522c07fc208dc4244b752ef571d6ce7d2 (patch)
treedb2f9381497a31e7dca516ca97a18080796d2997 /src/build_helper
parent1d1f248093289cb9cc2a3ae9b451f47895f2ba7f (diff)
downloadrust-0396f0e522c07fc208dc4244b752ef571d6ce7d2.tar.gz
rust-0396f0e522c07fc208dc4244b752ef571d6ce7d2.zip
Use `check_path_modifications` for detecting local LLVM changes
Diffstat (limited to 'src/build_helper')
-rw-r--r--src/build_helper/src/git.rs5
-rw-r--r--src/build_helper/src/git/tests.rs5
2 files changed, 8 insertions, 2 deletions
diff --git a/src/build_helper/src/git.rs b/src/build_helper/src/git.rs
index e1e7319b9aa..fce3a8eca9b 100644
--- a/src/build_helper/src/git.rs
+++ b/src/build_helper/src/git.rs
@@ -261,6 +261,11 @@ pub fn check_path_modifications(
         upstream_sha
     };
 
+    // For local environments, we want to find out if something has changed
+    // from the latest upstream commit.
+    // However, that should be equivalent to checking if something has changed
+    // from the latest upstream commit *that modified `target_paths`*, and
+    // with this approach we do not need to invoke git an additional time.
     if has_changed_since(git_dir, &upstream_sha, target_paths) {
         Ok(PathFreshness::HasLocalModifications { upstream: upstream_sha })
     } else {
diff --git a/src/build_helper/src/git/tests.rs b/src/build_helper/src/git/tests.rs
index cdf50e14218..cc502f08387 100644
--- a/src/build_helper/src/git/tests.rs
+++ b/src/build_helper/src/git/tests.rs
@@ -1,9 +1,10 @@
-use crate::ci::CiEnv;
-use crate::git::{GitConfig, PathFreshness, check_path_modifications};
 use std::ffi::OsStr;
 use std::fs::OpenOptions;
 use std::process::Command;
 
+use crate::ci::CiEnv;
+use crate::git::{GitConfig, PathFreshness, check_path_modifications};
+
 #[test]
 fn test_pr_ci_unchanged_anywhere() {
     git_test(|ctx| {