Skip to content

Commit 6b2cf78

Browse files
committed
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.
1 parent c87ba3f commit 6b2cf78

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
@@ -559,9 +559,11 @@ impl Build {
559559
match submodule.state {
560560
State::MaybeDirty => {
561561
// drop staged changes
562-
self.run(git().arg("-C").arg(submodule.path).args(&["reset", "--hard"]));
562+
self.run(git().current_dir(submodule.path)
563+
.args(&["reset", "--hard"]));
563564
// drops unstaged changes
564-
self.run(git().arg("-C").arg(submodule.path).args(&["clean", "-fdx"]));
565+
self.run(git().current_dir(submodule.path)
566+
.args(&["clean", "-fdx"]));
565567
},
566568
State::NotInitialized => {
567569
self.run(git_submodule().arg("init").arg(submodule.path));
@@ -570,8 +572,10 @@ impl Build {
570572
State::OutOfSync => {
571573
// drops submodule commits that weren't reported to the (outer) git repository
572574
self.run(git_submodule().arg("update").arg(submodule.path));
573-
self.run(git().arg("-C").arg(submodule.path).args(&["reset", "--hard"]));
574-
self.run(git().arg("-C").arg(submodule.path).args(&["clean", "-fdx"]));
575+
self.run(git().current_dir(submodule.path)
576+
.args(&["reset", "--hard"]));
577+
self.run(git().current_dir(submodule.path)
578+
.args(&["clean", "-fdx"]));
575579
},
576580
}
577581
}

0 commit comments

Comments
 (0)