diff options
author | Ben Straub <bs@github.com> | 2012-12-14 00:55:28 +0400 |
---|---|---|
committer | Ben Straub <bs@github.com> | 2012-12-15 01:58:44 +0400 |
commit | 850b1edfe8f04daaec05237e35e74f11600e5b4c (patch) | |
tree | 1d3556b4cfd4178548a510a331bcfc17232d51de /tests-clar/clone | |
parent | be5869fce0ab9c61a294020e9baa9755c58ee8a3 (diff) |
Allow clone to handle empty repos
Diffstat (limited to 'tests-clar/clone')
-rw-r--r-- | tests-clar/clone/nonetwork.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests-clar/clone/nonetwork.c b/tests-clar/clone/nonetwork.c index 623a0683f..0f4e77a48 100644 --- a/tests-clar/clone/nonetwork.c +++ b/tests-clar/clone/nonetwork.c @@ -86,3 +86,42 @@ void test_clone_nonetwork__fail_with_already_existing_but_non_empty_directory(vo cl_git_mkfile("./foo/bar", "Baz!"); cl_git_fail(git_clone(&g_repo, g_origin, "./foo", &g_options)); } + +void test_clone_nonetwork__can_clone_an_empty_local_repo_barely(void) +{ + const char *src = cl_git_fixture_url("empty_bare.git"); + cl_set_cleanup(&cleanup_repository, "./empty"); + + git_remote_free(g_origin); + cl_git_pass(git_remote_new(&g_origin, NULL, "origin", src, GIT_REMOTE_DEFAULT_FETCH)); + + cl_git_pass(git_clone_bare(&g_repo, g_origin, "./empty", NULL, NULL)); +} + +void test_clone_nonetwork__can_clone_an_empty_local_repo(void) +{ + const char *src = cl_git_fixture_url("empty_bare.git"); + cl_set_cleanup(&cleanup_repository, "./empty"); + + git_remote_free(g_origin); + cl_git_pass(git_remote_new(&g_origin, NULL, "origin", src, GIT_REMOTE_DEFAULT_FETCH)); + + cl_git_pass(git_clone(&g_repo, g_origin, "./empty", NULL, NULL, NULL)); +} + +void test_clone_nonetwork__can_clone_an_empty_standard_repo(void) +{ + const char *src; + + cl_git_sandbox_init("empty_standard_repo"); + src = cl_git_path_url("./empty_standard_repo"); + + git_remote_free(g_origin); + cl_git_pass(git_remote_new(&g_origin, NULL, "origin", src, GIT_REMOTE_DEFAULT_FETCH)); + + cl_set_cleanup(&cleanup_repository, "./empty"); + + cl_git_pass(git_clone(&g_repo, g_origin, "./empty", NULL, NULL, NULL)); + + cl_git_sandbox_cleanup(); +} |