diff options
author | Neil Kistner <neil.kistner@gmail.com> | 2019-09-07 11:25:01 -0500 |
---|---|---|
committer | Kevin Song <chipbuster@users.noreply.github.com> | 2019-09-07 11:25:01 -0500 |
commit | 6658b7f0aa09f2edb96bfe7c7be25377b939f2be (patch) | |
tree | 5cc6f013552cf92181b3fe6073fb01664be6dd4b /tests/testsuite/common.rs | |
parent | 3435b9cdc219afce1af1db98d68a7dfefb1653ab (diff) |
fix: Fixture repo will now clone and set git config locally (#307)
Diffstat (limited to 'tests/testsuite/common.rs')
-rw-r--r-- | tests/testsuite/common.rs | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/tests/testsuite/common.rs b/tests/testsuite/common.rs index 6698a1d94..60da0e26a 100644 --- a/tests/testsuite/common.rs +++ b/tests/testsuite/common.rs @@ -48,17 +48,10 @@ pub fn new_tempdir() -> io::Result<tempfile::TempDir> { /// Create a repo from the fixture to be used in git module tests pub fn create_fixture_repo() -> io::Result<std::path::PathBuf> { let fixture_repo_dir = new_tempdir()?.path().join("fixture"); + let repo_dir = new_tempdir()?.path().join("rocket"); let fixture = env::current_dir()?.join("tests/fixtures/rocket.bundle"); Command::new("git") - .args(&["config", "--global", "user.email", "starship@example.com"]) - .output()?; - - Command::new("git") - .args(&["config", "--global", "user.name", "starship"]) - .output()?; - - Command::new("git") .args(&[ "clone", "-b", @@ -68,7 +61,19 @@ pub fn create_fixture_repo() -> io::Result<std::path::PathBuf> { ]) .output()?; - Ok(fixture_repo_dir) + git2::Repository::clone(fixture_repo_dir.to_str().unwrap(), &repo_dir.as_path()).unwrap(); + + Command::new("git") + .args(&["config", "--local", "user.email", "starship@example.com"]) + .current_dir(repo_dir.as_path()) + .output()?; + + Command::new("git") + .args(&["config", "--local", "user.name", "starship"]) + .current_dir(repo_dir.as_path()) + .output()?; + + Ok(repo_dir) } /// Extends `std::process::Command` with methods for testing |