Skip to content

Commit

Permalink
rustbuild: Use current_dir instead of -C
Browse files Browse the repository at this point in the history
Apparently some versions of git don't support the `-C` flag, so let's use the
guaranteed-to-work `current_dir` function.
  • Loading branch information
alexcrichton committed Sep 13, 2016
1 parent c87ba3f commit 6b2cf78
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,9 +559,11 @@ impl Build {
match submodule.state {
State::MaybeDirty => {
// drop staged changes
self.run(git().arg("-C").arg(submodule.path).args(&["reset", "--hard"]));
self.run(git().current_dir(submodule.path)
.args(&["reset", "--hard"]));
// drops unstaged changes
self.run(git().arg("-C").arg(submodule.path).args(&["clean", "-fdx"]));
self.run(git().current_dir(submodule.path)
.args(&["clean", "-fdx"]));
},
State::NotInitialized => {
self.run(git_submodule().arg("init").arg(submodule.path));
Expand All @@ -570,8 +572,10 @@ impl Build {
State::OutOfSync => {
// drops submodule commits that weren't reported to the (outer) git repository
self.run(git_submodule().arg("update").arg(submodule.path));
self.run(git().arg("-C").arg(submodule.path).args(&["reset", "--hard"]));
self.run(git().arg("-C").arg(submodule.path).args(&["clean", "-fdx"]));
self.run(git().current_dir(submodule.path)
.args(&["reset", "--hard"]));
self.run(git().current_dir(submodule.path)
.args(&["clean", "-fdx"]));
},
}
}
Expand Down

0 comments on commit 6b2cf78

Please sign in to comment.