Skip to content

Commit 25f7d4b

Browse files
committed
Remove new_repo_without_add_and_commit
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
1 parent 89b8a8b commit 25f7d4b

File tree

2 files changed

+5
-17
lines changed

2 files changed

+5
-17
lines changed

crates/cargo-test-support/src/git.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -175,20 +175,6 @@ where
175175
(git_project, repo)
176176
}
177177

178-
/// Create a new git repository with a project.
179-
/// Returns both the Project and the git Repository but does not commit.
180-
pub fn new_repo_without_add_and_commit<F>(name: &str, callback: F) -> (Project, git2::Repository)
181-
where
182-
F: FnOnce(ProjectBuilder) -> ProjectBuilder,
183-
{
184-
let mut git_project = project().at(name);
185-
git_project = callback(git_project);
186-
let git_project = git_project.build();
187-
188-
let repo = init(&git_project.root());
189-
(git_project, repo)
190-
}
191-
192178
/// Add all files in the working directory to the git index.
193179
pub fn add(repo: &git2::Repository) {
194180
// FIXME(libgit2/libgit2#2514): apparently, `add_all` will add all submodules

tests/testsuite/fix.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use cargo::core::Edition;
44
use cargo_test_support::compare::assert_match_exact;
5-
use cargo_test_support::git;
5+
use cargo_test_support::git::{self, init};
66
use cargo_test_support::paths::{self, CargoPathExt};
77
use cargo_test_support::registry::{Dependency, Package};
88
use cargo_test_support::tools;
@@ -773,8 +773,10 @@ commit the changes to these files:
773773

774774
#[cargo_test]
775775
fn errors_on_empty_repo() {
776-
let (p, _) =
777-
git::new_repo_without_add_and_commit("foo", |p| p.file("src/lib.rs", "pub fn foo() {}"));
776+
let mut git_project = project().at("foo");
777+
git_project = git_project.file("src/lib.rs", "pub fn foo() {}");
778+
let p = git_project.build();
779+
let _ = init(&p.root());
778780

779781
p.cargo("fix")
780782
.with_status(101)

0 commit comments

Comments
 (0)