Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove unnecessary git usages #127552

Merged
merged 1 commit into from
Jul 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 7 additions & 16 deletions src/bootstrap/src/core/config/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2445,14 +2445,6 @@ impl Config {
}
};

// Handle running from a directory other than the top level
let top_level = output(
&mut helpers::git(Some(&self.src)).args(["rev-parse", "--show-toplevel"]).command,
);
let top_level = top_level.trim_end();
let compiler = format!("{top_level}/compiler/");
let library = format!("{top_level}/library/");

// Look for a version to compare to based on the current commit.
// Only commits merged by bors will have CI artifacts.
let merge_base = output(
Expand All @@ -2473,7 +2465,9 @@ impl Config {

// Warn if there were changes to the compiler or standard library since the ancestor commit.
let has_changes = !t!(helpers::git(Some(&self.src))
.args(["diff-index", "--quiet", commit, "--", &compiler, &library])
.args(["diff-index", "--quiet", commit])
.arg("--")
.args([self.src.join("compiler"), self.src.join("library")])
.command
.status())
.success();
Expand Down Expand Up @@ -2545,12 +2539,6 @@ impl Config {
option_name: &str,
if_unchanged: bool,
) -> Option<String> {
// Handle running from a directory other than the top level
let top_level = output(
&mut helpers::git(Some(&self.src)).args(["rev-parse", "--show-toplevel"]).command,
);
let top_level = top_level.trim_end();

// Look for a version to compare to based on the current commit.
// Only commits merged by bors will have CI artifacts.
let merge_base = output(
Expand All @@ -2573,8 +2561,11 @@ impl Config {
let mut git = helpers::git(Some(&self.src));
git.args(["diff-index", "--quiet", commit, "--"]);

// Handle running from a directory other than the top level
let top_level = &self.src;

for path in modified_paths {
git.arg(format!("{top_level}/{path}"));
git.arg(top_level.join(path));
}

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