diff --git a/crates/cargo-test-support/src/git.rs b/crates/cargo-test-support/src/git.rs index cb2ea38a8c0a..18c4646b37d2 100644 --- a/crates/cargo-test-support/src/git.rs +++ b/crates/cargo-test-support/src/git.rs @@ -175,20 +175,6 @@ where (git_project, repo) } -/// Create a new git repository with a project. -/// Returns both the Project and the git Repository but does not commit. -pub fn new_repo_without_add_and_commit(name: &str, callback: F) -> (Project, git2::Repository) -where - F: FnOnce(ProjectBuilder) -> ProjectBuilder, -{ - let mut git_project = project().at(name); - git_project = callback(git_project); - let git_project = git_project.build(); - - let repo = init(&git_project.root()); - (git_project, repo) -} - /// Add all files in the working directory to the git index. pub fn add(repo: &git2::Repository) { // FIXME(libgit2/libgit2#2514): apparently, `add_all` will add all submodules diff --git a/tests/testsuite/fix.rs b/tests/testsuite/fix.rs index 790d105d74b9..897433cb000c 100644 --- a/tests/testsuite/fix.rs +++ b/tests/testsuite/fix.rs @@ -2,7 +2,7 @@ use cargo::core::Edition; use cargo_test_support::compare::assert_match_exact; -use cargo_test_support::git; +use cargo_test_support::git::{self, init}; use cargo_test_support::paths::{self, CargoPathExt}; use cargo_test_support::registry::{Dependency, Package}; use cargo_test_support::tools; @@ -773,8 +773,10 @@ commit the changes to these files: #[cargo_test] fn errors_on_empty_repo() { - let (p, _) = - git::new_repo_without_add_and_commit("foo", |p| p.file("src/lib.rs", "pub fn foo() {}")); + let mut git_project = project().at("foo"); + git_project = git_project.file("src/lib.rs", "pub fn foo() {}"); + let p = git_project.build(); + let _ = init(&p.root()); p.cargo("fix") .with_status(101)