diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2014-06-30 23:36:38 +0400 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2014-07-02 09:05:00 +0400 |
commit | 6812afaf385422fbcc6fb494ff892426fbce1cbc (patch) | |
tree | c29698b438b6c74e73eeb9f220e230f1ef33539a /tests/clone | |
parent | d58a64e9a5d32b511447943f20a84340b520872f (diff) |
clone: remote git_clone_into{,_local} from the public API
As git_clone now has callbacks to configure the details of the
repository and remote, remove the lower-level functions from the public
API, as they lack some of the logic from git_clone proper.
Diffstat (limited to 'tests/clone')
-rw-r--r-- | tests/clone/local.c | 28 | ||||
-rw-r--r-- | tests/clone/nonetwork.c | 17 |
2 files changed, 8 insertions, 37 deletions
diff --git a/tests/clone/local.c b/tests/clone/local.c index a4406c1cc..c8ebc143d 100644 --- a/tests/clone/local.c +++ b/tests/clone/local.c @@ -31,31 +31,24 @@ void test_clone_local__should_clone_local(void) void test_clone_local__hardlinks(void) { git_repository *repo; - git_remote *remote; - git_signature *sig; + git_clone_options opts = GIT_CLONE_OPTIONS_INIT; git_buf buf = GIT_BUF_INIT; struct stat st; - /* * In this first clone, we just copy over, since the temp dir * will often be in a different filesystem, so we cannot * link. It also allows us to control the number of links */ - cl_git_pass(git_repository_init(&repo, "./clone.git", true)); - cl_git_pass(git_remote_create(&remote, repo, "origin", cl_fixture("testrepo.git"))); - cl_git_pass(git_signature_now(&sig, "foo", "bar")); - cl_git_pass(git_clone_local_into(repo, remote, NULL, NULL, false, sig)); - - git_remote_free(remote); + opts.bare = true; + opts.local = GIT_CLONE_LOCAL_NO_LINKS; + cl_git_pass(git_clone(&repo, cl_fixture("testrepo.git"), "./clone.git", &opts)); git_repository_free(repo); /* This second clone is in the same filesystem, so we can hardlink */ - cl_git_pass(git_repository_init(&repo, "./clone2.git", true)); - cl_git_pass(git_buf_puts(&buf, cl_git_path_url("clone.git"))); - cl_git_pass(git_remote_create(&remote, repo, "origin", buf.ptr)); - cl_git_pass(git_clone_local_into(repo, remote, NULL, NULL, true, sig)); + opts.local = GIT_CLONE_LOCAL; + cl_git_pass(git_clone(&repo, cl_git_path_url("clone.git"), "./clone2.git", &opts)); #ifndef GIT_WIN32 git_buf_clear(&buf); @@ -65,14 +58,11 @@ void test_clone_local__hardlinks(void) cl_assert_equal_i(2, st.st_nlink); #endif - git_remote_free(remote); git_repository_free(repo); git_buf_clear(&buf); - cl_git_pass(git_repository_init(&repo, "./clone3.git", true)); - cl_git_pass(git_buf_puts(&buf, cl_git_path_url("clone.git"))); - cl_git_pass(git_remote_create(&remote, repo, "origin", buf.ptr)); - cl_git_pass(git_clone_local_into(repo, remote, NULL, NULL, false, sig)); + opts.local = GIT_CLONE_LOCAL_NO_LINKS; + cl_git_pass(git_clone(&repo, cl_git_path_url("clone.git"), "./clone3.git", &opts)); git_buf_clear(&buf); cl_git_pass(git_buf_join_n(&buf, '/', 4, git_repository_path(repo), "objects", "08", "b041783f40edfe12bb406c9c9a8a040177c125")); @@ -80,7 +70,6 @@ void test_clone_local__hardlinks(void) cl_git_pass(p_stat(buf.ptr, &st)); cl_assert_equal_i(1, st.st_nlink); - git_remote_free(remote); git_repository_free(repo); /* this one should automatically use links */ @@ -95,7 +84,6 @@ void test_clone_local__hardlinks(void) #endif git_buf_free(&buf); - git_signature_free(sig); git_repository_free(repo); cl_git_pass(git_futils_rmdir_r("./clone.git", NULL, GIT_RMDIR_REMOVE_FILES)); diff --git a/tests/clone/nonetwork.c b/tests/clone/nonetwork.c index ab3e8f50d..824988a58 100644 --- a/tests/clone/nonetwork.c +++ b/tests/clone/nonetwork.c @@ -279,23 +279,6 @@ void test_clone_nonetwork__clone_updates_reflog_properly(void) assert_correct_reflog("refs/heads/master"); } -void test_clone_nonetwork__clone_into_updates_reflog_properly(void) -{ - git_remote *remote; - git_signature *sig; - cl_git_pass(git_signature_now(&sig, "Me", "foo@example.com")); - - cl_git_pass(git_repository_init(&g_repo, "./foo", false)); - cl_git_pass(git_remote_create(&remote, g_repo, "origin", cl_git_fixture_url("testrepo.git"))); - cl_git_pass(git_clone_into(g_repo, remote, NULL, NULL, sig)); - - assert_correct_reflog("HEAD"); - assert_correct_reflog("refs/heads/master"); - - git_remote_free(remote); - git_signature_free(sig); -} - static void cleanup_repository(void *path) { if (g_repo) { |