Skip to content

Commit

Permalink
Do not rely on local repo having test branches.
Browse files Browse the repository at this point in the history
  • Loading branch information
de-vri-es committed Dec 13, 2023
1 parent cc55867 commit 1c7dde6
Showing 1 changed file with 33 additions and 5 deletions.
38 changes: 33 additions & 5 deletions git-version/tests/version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,47 @@ fn test_in_external_clone() {
let target_dir = target_dir.join("tests_target");

let_assert!(Ok(result) = std::process::Command::new("git")
.arg("-c")
.arg("protocol.file.allow=always")
.arg("clone")
.arg("--quiet")
.arg("--recurse-submodules")
.arg("-b")
.arg("test-root")
.arg((lib_dir).join(".."))
.arg(tempdir.path())
.status()
);
assert!(result.success(), "git clone: {result}");

let_assert!(Ok(result) = std::process::Command::new("git")
.current_dir(&tempdir)
.arg("-c")
.arg("protocol.file.allow=always")
.arg("fetch")
.arg("--quiet")
.arg("origin")
.arg("+refs/remotes/origin/test-*:refs/heads/test-*")
.status()
);
assert!(result.success(), "git fetch: {result}");

let_assert!(Ok(result) = std::process::Command::new("git")
.current_dir(&tempdir)
.arg("switch")
.arg("--quiet")
.arg("test-root")
.status()
);
assert!(result.success(), "git fetch: {result}");

let_assert!(Ok(result) = std::process::Command::new("git")
.current_dir(&tempdir)
.arg("-c")
.arg("protocol.file.allow=always")
.arg("submodule")
.arg("--quiet")
.arg("update")
.arg("--init")
.status()
);
assert!(result.success(), "git fetch: {result}");

let_assert!(Ok(result) = std::process::Command::new("cargo")
.current_dir(&tempdir)
.arg("add")
Expand Down

0 comments on commit 1c7dde6

Please sign in to comment.