Skip to content

Commit

Permalink
Auto merge of rust-lang#36456 - alexcrichton:rustbuild-dont-use-c, r=…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
bors committed Sep 29, 2016
2 parents 91f34c0 + d68f7eb commit 704bcc0
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -557,12 +557,18 @@ impl Build {
continue
}

if !submodule.path.exists() {
t!(fs::create_dir_all(&submodule.path));
}

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 @@ -571,8 +577,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 704bcc0

Please sign in to comment.