Skip to content

Commit eb2bfc9

Browse files
author
Jonathan Turner
authored
Rollup merge of rust-lang#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 b291790 + 6b2cf78 commit eb2bfc9

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/bootstrap/lib.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -553,9 +553,11 @@ impl Build {
553553
match submodule.state {
554554
State::MaybeDirty => {
555555
// drop staged changes
556-
self.run(git().arg("-C").arg(submodule.path).args(&["reset", "--hard"]));
556+
self.run(git().current_dir(submodule.path)
557+
.args(&["reset", "--hard"]));
557558
// drops unstaged changes
558-
self.run(git().arg("-C").arg(submodule.path).args(&["clean", "-fdx"]));
559+
self.run(git().current_dir(submodule.path)
560+
.args(&["clean", "-fdx"]));
559561
},
560562
State::NotInitialized => {
561563
self.run(git_submodule().arg("init").arg(submodule.path));
@@ -564,8 +566,10 @@ impl Build {
564566
State::OutOfSync => {
565567
// drops submodule commits that weren't reported to the (outer) git repository
566568
self.run(git_submodule().arg("update").arg(submodule.path));
567-
self.run(git().arg("-C").arg(submodule.path).args(&["reset", "--hard"]));
568-
self.run(git().arg("-C").arg(submodule.path).args(&["clean", "-fdx"]));
569+
self.run(git().current_dir(submodule.path)
570+
.args(&["reset", "--hard"]));
571+
self.run(git().current_dir(submodule.path)
572+
.args(&["clean", "-fdx"]));
569573
},
570574
}
571575
}

0 commit comments

Comments
 (0)