Skip to content

Commit 0134bd2

Browse files
committed
remove unnecessary git usages
`Config::src` already contains the top-level path, so we don't need to add git overhead just to reach this path. Signed-off-by: onur-ozkan <[email protected]>
1 parent 382148d commit 0134bd2

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

src/bootstrap/src/core/config/config.rs

+7-16
Original file line numberDiff line numberDiff line change
@@ -2445,14 +2445,6 @@ impl Config {
24452445
}
24462446
};
24472447

2448-
// Handle running from a directory other than the top level
2449-
let top_level = output(
2450-
&mut helpers::git(Some(&self.src)).args(["rev-parse", "--show-toplevel"]).command,
2451-
);
2452-
let top_level = top_level.trim_end();
2453-
let compiler = format!("{top_level}/compiler/");
2454-
let library = format!("{top_level}/library/");
2455-
24562448
// Look for a version to compare to based on the current commit.
24572449
// Only commits merged by bors will have CI artifacts.
24582450
let merge_base = output(
@@ -2473,7 +2465,9 @@ impl Config {
24732465

24742466
// Warn if there were changes to the compiler or standard library since the ancestor commit.
24752467
let has_changes = !t!(helpers::git(Some(&self.src))
2476-
.args(["diff-index", "--quiet", commit, "--", &compiler, &library])
2468+
.args(["diff-index", "--quiet", commit])
2469+
.arg("--")
2470+
.args([self.src.join("compiler"), self.src.join("library")])
24772471
.command
24782472
.status())
24792473
.success();
@@ -2545,12 +2539,6 @@ impl Config {
25452539
option_name: &str,
25462540
if_unchanged: bool,
25472541
) -> Option<String> {
2548-
// Handle running from a directory other than the top level
2549-
let top_level = output(
2550-
&mut helpers::git(Some(&self.src)).args(["rev-parse", "--show-toplevel"]).command,
2551-
);
2552-
let top_level = top_level.trim_end();
2553-
25542542
// Look for a version to compare to based on the current commit.
25552543
// Only commits merged by bors will have CI artifacts.
25562544
let merge_base = output(
@@ -2573,8 +2561,11 @@ impl Config {
25732561
let mut git = helpers::git(Some(&self.src));
25742562
git.args(["diff-index", "--quiet", commit, "--"]);
25752563

2564+
// Handle running from a directory other than the top level
2565+
let top_level = &self.src;
2566+
25762567
for path in modified_paths {
2577-
git.arg(format!("{top_level}/{path}"));
2568+
git.arg(top_level.join(path));
25782569
}
25792570

25802571
let has_changes = !t!(git.command.status()).success();

0 commit comments

Comments
 (0)