Skip to content

Commit 704bcc0

Browse files
authored
Auto merge of #36456 - alexcrichton:rustbuild-dont-use-c, r=jonathandturner
rustbuild: Use current_dir instead of -C Apparently some versions of git don't support the `-C` flag, so let's use the guaranteed-to-work `current_dir` function.
2 parents 91f34c0 + d68f7eb commit 704bcc0

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/bootstrap/lib.rs

+12-4
Original file line numberDiff line numberDiff line change
@@ -557,12 +557,18 @@ impl Build {
557557
continue
558558
}
559559

560+
if !submodule.path.exists() {
561+
t!(fs::create_dir_all(&submodule.path));
562+
}
563+
560564
match submodule.state {
561565
State::MaybeDirty => {
562566
// drop staged changes
563-
self.run(git().arg("-C").arg(submodule.path).args(&["reset", "--hard"]));
567+
self.run(git().current_dir(submodule.path)
568+
.args(&["reset", "--hard"]));
564569
// drops unstaged changes
565-
self.run(git().arg("-C").arg(submodule.path).args(&["clean", "-fdx"]));
570+
self.run(git().current_dir(submodule.path)
571+
.args(&["clean", "-fdx"]));
566572
},
567573
State::NotInitialized => {
568574
self.run(git_submodule().arg("init").arg(submodule.path));
@@ -571,8 +577,10 @@ impl Build {
571577
State::OutOfSync => {
572578
// drops submodule commits that weren't reported to the (outer) git repository
573579
self.run(git_submodule().arg("update").arg(submodule.path));
574-
self.run(git().arg("-C").arg(submodule.path).args(&["reset", "--hard"]));
575-
self.run(git().arg("-C").arg(submodule.path).args(&["clean", "-fdx"]));
580+
self.run(git().current_dir(submodule.path)
581+
.args(&["reset", "--hard"]));
582+
self.run(git().current_dir(submodule.path)
583+
.args(&["clean", "-fdx"]));
576584
},
577585
}
578586
}

0 commit comments

Comments
 (0)