diff options
author | Justin Wernick <justin@worthe-it.co.za> | 2023-07-17 20:08:19 +0200 |
---|---|---|
committer | Justin Wernick <justin@worthe-it.co.za> | 2023-07-17 20:08:19 +0200 |
commit | 34cfee142362b459c0b3ca9c7f482a76166a4a49 (patch) | |
tree | ada9ef49cf24e56a715eb8121e9d266e05d14928 | |
parent | 3ed958e4fafe3e1d0b1dea1a8cf1a8c601cad2c0 (diff) |
Standardise main branch name used in tests
-rw-r--r-- | tests/cli_test_utils/git.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/cli_test_utils/git.rs b/tests/cli_test_utils/git.rs index 99177e8..961592e 100644 --- a/tests/cli_test_utils/git.rs +++ b/tests/cli_test_utils/git.rs @@ -15,7 +15,17 @@ pub fn create_clone(c: &TestContext, repo_dir: &Path, relative_name: &str) -> Pa .timeout(std::time::Duration::from_secs(3)) .assert() .success(); - c.workdir.as_ref().join(relative_name) + + let repo_dir = c.workdir.as_ref().join(relative_name); + + // standardising the main branch of our clone simplifies things. + Command::new("git") + .args(["checkout", "-b", "main"]) + .current_dir(&repo_dir) + .assert() + .success(); + + repo_dir } pub fn create_commit(repo_dir: &Path) -> Result<String> { |