remove unnecessary `git` usages · rust-lang/rust@0134bd2

@@ -2445,14 +2445,6 @@ impl Config {

24452445

}

24462446

};

244724472448-

// 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 {

2473246524742466

// 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, "--"]);

257525632564+

// 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

}

2579257025802571

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