Rollup merge of #127552 - onur-ozkan:unnecessary-git-usage, r=Kobzol · rust-lang/rust@b4f002d

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

24662466

}

24672467

};

246824682469-

// Handle running from a directory other than the top level

2470-

let top_level = output(

2471-

&mut helpers::git(Some(&self.src)).args(["rev-parse", "--show-toplevel"]).command,

2472-

);

2473-

let top_level = top_level.trim_end();

2474-

let compiler = format!("{top_level}/compiler/");

2475-

let library = format!("{top_level}/library/");

2476-24772469

// Look for a version to compare to based on the current commit.

24782470

// Only commits merged by bors will have CI artifacts.

24792471

let merge_base = output(

@@ -2494,7 +2486,9 @@ impl Config {

2494248624952487

// Warn if there were changes to the compiler or standard library since the ancestor commit.

24962488

let has_changes = !t!(helpers::git(Some(&self.src))

2497-

.args(["diff-index", "--quiet", commit, "--", &compiler, &library])

2489+

.args(["diff-index", "--quiet", commit])

2490+

.arg("--")

2491+

.args([self.src.join("compiler"), self.src.join("library")])

24982492

.command

24992493

.status())

25002494

.success();

@@ -2566,12 +2560,6 @@ impl Config {

25662560

option_name: &str,

25672561

if_unchanged: bool,

25682562

) -> Option<String> {

2569-

// Handle running from a directory other than the top level

2570-

let top_level = output(

2571-

&mut helpers::git(Some(&self.src)).args(["rev-parse", "--show-toplevel"]).command,

2572-

);

2573-

let top_level = top_level.trim_end();

2574-25752563

// Look for a version to compare to based on the current commit.

25762564

// Only commits merged by bors will have CI artifacts.

25772565

let merge_base = output(

@@ -2594,8 +2582,11 @@ impl Config {

25942582

let mut git = helpers::git(Some(&self.src));

25952583

git.args(["diff-index", "--quiet", commit, "--"]);

259625842585+

// Handle running from a directory other than the top level

2586+

let top_level = &self.src;

2587+25972588

for path in modified_paths {

2598-

git.arg(format!("{top_level}/{path}"));

2589+

git.arg(top_level.join(path));

25992590

}

2600259126012592

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