Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Straub <bs@github.com>2012-12-19 07:46:05 +0400
committerBen Straub <bs@github.com>2012-12-20 05:02:06 +0400
commitb412d5638929f8b08ea63d862a1a46b3d9f9e4c9 (patch)
tree48dc978184c76d47c5877d0350b159323dae0f02 /tests-clar/clone
parent92c4d25820a55186f3834891673fb9d72715d978 (diff)
Add more clone options. Push test suite segfaults.
Diffstat (limited to 'tests-clar/clone')
-rw-r--r--tests-clar/clone/empty.c22
-rw-r--r--tests-clar/clone/network.c22
-rw-r--r--tests-clar/clone/nonetwork.c30
3 files changed, 18 insertions, 56 deletions
diff --git a/tests-clar/clone/empty.c b/tests-clar/clone/empty.c
index 8f2e6ff12..652363747 100644
--- a/tests-clar/clone/empty.c
+++ b/tests-clar/clone/empty.c
@@ -4,7 +4,6 @@
#include "repository.h"
static git_clone_options g_options;
-static git_remote *g_origin;
static git_repository *g_repo;
static git_repository *g_repo_cloned;
@@ -17,13 +16,10 @@ void test_clone_empty__initialize(void)
memset(&g_options, 0, sizeof(git_clone_options));
g_options.version = GIT_CLONE_OPTIONS_VERSION;
- cl_git_pass(git_remote_new(&g_origin, NULL, "origin", cl_git_fixture_url("testrepo.git"), GIT_REMOTE_DEFAULT_FETCH));
}
void test_clone_empty__cleanup(void)
{
- git_remote_free(g_origin);
- g_origin = NULL;
cl_git_sandbox_cleanup();
}
@@ -39,23 +35,15 @@ void test_clone_empty__can_clone_an_empty_local_repo_barely(void)
{
cl_set_cleanup(&cleanup_repository, "./empty");
- git_remote_free(g_origin);
- g_origin = NULL;
- cl_git_pass(git_remote_new(&g_origin, NULL, "origin", "./empty_bare.git", GIT_REMOTE_DEFAULT_FETCH));
-
g_options.bare = true;
- cl_git_pass(git_clone(&g_repo_cloned, g_origin, "./empty", &g_options));
+ cl_git_pass(git_clone(&g_repo_cloned, "./empty_bare.git", "./empty", &g_options));
}
void test_clone_empty__can_clone_an_empty_local_repo(void)
{
cl_set_cleanup(&cleanup_repository, "./empty");
- git_remote_free(g_origin);
- g_origin = NULL;
- cl_git_pass(git_remote_new(&g_origin, NULL, "origin", "./empty_bare.git", GIT_REMOTE_DEFAULT_FETCH));
-
- cl_git_pass(git_clone(&g_repo_cloned, g_origin, "./empty", &g_options));
+ cl_git_pass(git_clone(&g_repo_cloned, "./empty_bare.git", "./empty", &g_options));
}
void test_clone_empty__can_clone_an_empty_standard_repo(void)
@@ -64,11 +52,7 @@ void test_clone_empty__can_clone_an_empty_standard_repo(void)
g_repo = cl_git_sandbox_init("empty_standard_repo");
cl_git_remove_placeholders(git_repository_path(g_repo), "dummy-marker.txt");
- git_remote_free(g_origin);
- g_origin = NULL;
- cl_git_pass(git_remote_new(&g_origin, NULL, "origin", "./empty_standard_repo", GIT_REMOTE_DEFAULT_FETCH));
-
cl_set_cleanup(&cleanup_repository, "./empty");
- cl_git_pass(git_clone(&g_repo_cloned, g_origin, "./empty", &g_options));
+ cl_git_pass(git_clone(&g_repo_cloned, "./empty_standard_repo", "./empty", &g_options));
}
diff --git a/tests-clar/clone/network.c b/tests-clar/clone/network.c
index d3009660e..c8409394e 100644
--- a/tests-clar/clone/network.c
+++ b/tests-clar/clone/network.c
@@ -9,7 +9,6 @@ CL_IN_CATEGORY("network")
#define LIVE_EMPTYREPO_URL "http://github.com/libgit2/TestEmptyRepository"
static git_repository *g_repo;
-static git_remote *g_origin;
static git_clone_options g_options;
void test_clone_network__initialize(void)
@@ -18,12 +17,6 @@ void test_clone_network__initialize(void)
memset(&g_options, 0, sizeof(git_clone_options));
g_options.version = GIT_CLONE_OPTIONS_VERSION;
- cl_git_pass(git_remote_new(&g_origin, NULL, "origin", LIVE_REPO_URL, GIT_REMOTE_DEFAULT_FETCH));
-}
-
-void test_clone_network__cleanup(void)
-{
- git_remote_free(g_origin);
}
static void cleanup_repository(void *path)
@@ -42,7 +35,7 @@ void test_clone_network__network_full(void)
cl_set_cleanup(&cleanup_repository, "./foo");
- cl_git_pass(git_clone(&g_repo, g_origin, "./foo", &g_options));
+ cl_git_pass(git_clone(&g_repo, LIVE_REPO_URL, "./foo", &g_options));
cl_assert(!git_repository_is_bare(g_repo));
cl_git_pass(git_remote_load(&origin, g_repo, "origin"));
@@ -57,7 +50,7 @@ void test_clone_network__network_bare(void)
cl_set_cleanup(&cleanup_repository, "./foo");
g_options.bare = true;
- cl_git_pass(git_clone(&g_repo, g_origin, "./foo", &g_options));
+ cl_git_pass(git_clone(&g_repo, LIVE_REPO_URL, "./foo", &g_options));
cl_assert(git_repository_is_bare(g_repo));
cl_git_pass(git_remote_load(&origin, g_repo, "origin"));
@@ -69,7 +62,7 @@ void test_clone_network__cope_with_already_existing_directory(void)
cl_set_cleanup(&cleanup_repository, "./foo");
p_mkdir("./foo", GIT_DIR_MODE);
- cl_git_pass(git_clone(&g_repo, g_origin, "./foo", &g_options));
+ cl_git_pass(git_clone(&g_repo, LIVE_REPO_URL, "./foo", &g_options));
}
void test_clone_network__empty_repository(void)
@@ -78,10 +71,7 @@ void test_clone_network__empty_repository(void)
cl_set_cleanup(&cleanup_repository, "./foo");
- git_remote_free(g_origin);
- cl_git_pass(git_remote_new(&g_origin, NULL, "origin", LIVE_EMPTYREPO_URL, GIT_REMOTE_DEFAULT_FETCH));
-
- cl_git_pass(git_clone(&g_repo, g_origin, "./foo", &g_options));
+ cl_git_pass(git_clone(&g_repo, LIVE_EMPTYREPO_URL, "./foo", &g_options));
cl_assert_equal_i(true, git_repository_is_empty(g_repo));
cl_assert_equal_i(true, git_repository_head_orphan(g_repo));
@@ -98,7 +88,7 @@ void test_clone_network__can_prevent_the_checkout_of_a_standard_repo(void)
git_buf path = GIT_BUF_INIT;
cl_set_cleanup(&cleanup_repository, "./foo");
- cl_git_pass(git_clone(&g_repo, g_origin, "./foo", &g_options));
+ cl_git_pass(git_clone(&g_repo, LIVE_REPO_URL, "./foo", &g_options));
cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(g_repo), "master.txt"));
cl_assert_equal_i(false, git_path_isfile(git_buf_cstr(&path)));
@@ -137,7 +127,7 @@ void test_clone_network__can_checkout_a_cloned_repo(void)
cl_set_cleanup(&cleanup_repository, "./foo");
- cl_git_pass(git_clone(&g_repo, g_origin, "./foo", &g_options));
+ cl_git_pass(git_clone(&g_repo, LIVE_REPO_URL, "./foo", &g_options));
cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(g_repo), "master.txt"));
cl_assert_equal_i(true, git_path_isfile(git_buf_cstr(&path)));
diff --git a/tests-clar/clone/nonetwork.c b/tests-clar/clone/nonetwork.c
index 623a0683f..8cf4a46ee 100644
--- a/tests-clar/clone/nonetwork.c
+++ b/tests-clar/clone/nonetwork.c
@@ -6,7 +6,6 @@
#define LIVE_REPO_URL "git://github.com/libgit2/TestGitRepository"
static git_clone_options g_options;
-static git_remote *g_origin;
static git_repository *g_repo;
void test_clone_nonetwork__initialize(void)
@@ -15,12 +14,6 @@ void test_clone_nonetwork__initialize(void)
memset(&g_options, 0, sizeof(git_clone_options));
g_options.version = GIT_CLONE_OPTIONS_VERSION;
- cl_git_pass(git_remote_new(&g_origin, NULL, "origin", cl_git_fixture_url("testrepo.git"), GIT_REMOTE_DEFAULT_FETCH));
-}
-
-void test_clone_nonetwork__cleanup(void)
-{
- git_remote_free(g_origin);
}
static void cleanup_repository(void *path)
@@ -36,38 +29,33 @@ static void cleanup_repository(void *path)
void test_clone_nonetwork__bad_url(void)
{
/* Clone should clean up the mess if the URL isn't a git repository */
- git_remote_free(g_origin);
- cl_git_pass(git_remote_new(&g_origin, NULL, "origin", "not_a_repo", GIT_REMOTE_DEFAULT_FETCH));
-
- cl_git_fail(git_clone(&g_repo, g_origin, "./foo", &g_options));
+ cl_git_fail(git_clone(&g_repo, "not_a_repo", "./foo", &g_options));
cl_assert(!git_path_exists("./foo"));
g_options.bare = true;
- cl_git_fail(git_clone(&g_repo, g_origin, "./foo", &g_options));
+ cl_git_fail(git_clone(&g_repo, "not_a_repo", "./foo", &g_options));
cl_assert(!git_path_exists("./foo"));
}
void test_clone_nonetwork__local(void)
{
cl_set_cleanup(&cleanup_repository, "./foo");
- cl_git_pass(git_clone(&g_repo, g_origin, "./foo", &g_options));
+ cl_git_pass(git_clone(&g_repo, cl_git_fixture_url("testrepo.git"), "./foo", &g_options));
}
void test_clone_nonetwork__local_absolute_path(void)
{
- const char *local_src = cl_fixture("testrepo.git");
- git_remote_free(g_origin);
- cl_git_pass(git_remote_new(&g_origin, NULL, "origin", local_src, GIT_REMOTE_DEFAULT_FETCH));
-
cl_set_cleanup(&cleanup_repository, "./foo");
- cl_git_pass(git_clone(&g_repo, g_origin, "./foo", &g_options));
+ const char *local_src = cl_fixture("testrepo.git");
+ cl_git_pass(git_clone(&g_repo, local_src, "./foo", &g_options));
}
void test_clone_nonetwork__local_bare(void)
{
cl_set_cleanup(&cleanup_repository, "./foo");
+
g_options.bare = true;
- cl_git_pass(git_clone(&g_repo, g_origin, "./foo", &g_options));
+ cl_git_pass(git_clone(&g_repo, cl_git_fixture_url("testrepo.git"), "./foo", &g_options));
}
void test_clone_nonetwork__fail_when_the_target_is_a_file(void)
@@ -75,7 +63,7 @@ void test_clone_nonetwork__fail_when_the_target_is_a_file(void)
cl_set_cleanup(&cleanup_repository, "./foo");
cl_git_mkfile("./foo", "Bar!");
- cl_git_fail(git_clone(&g_repo, g_origin, "./foo", &g_options));
+ cl_git_fail(git_clone(&g_repo, cl_git_fixture_url("testrepo.git"), "./foo", &g_options));
}
void test_clone_nonetwork__fail_with_already_existing_but_non_empty_directory(void)
@@ -84,5 +72,5 @@ void test_clone_nonetwork__fail_with_already_existing_but_non_empty_directory(vo
p_mkdir("./foo", GIT_DIR_MODE);
cl_git_mkfile("./foo/bar", "Baz!");
- cl_git_fail(git_clone(&g_repo, g_origin, "./foo", &g_options));
+ cl_git_fail(git_clone(&g_repo, cl_git_fixture_url("testrepo.git"), "./foo", &g_options));
}