mirror of
https://git.proxmox.com/git/libgit2
synced 2025-06-15 21:19:41 +00:00
Stop premature remote freeing when cloning
This commit is contained in:
parent
34c8c75433
commit
24393ea6d3
@ -82,6 +82,7 @@ int do_clone(git_repository *repo, int argc, char **argv)
|
|||||||
|
|
||||||
// Do the clone
|
// Do the clone
|
||||||
error = git_clone(&cloned_repo, origin, path, &checkout_opts, &fetch_progress, &pd);
|
error = git_clone(&cloned_repo, origin, path, &checkout_opts, &fetch_progress, &pd);
|
||||||
|
git_remote_free(origin);
|
||||||
printf("\n");
|
printf("\n");
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
const git_error *err = giterr_last();
|
const git_error *err = giterr_last();
|
||||||
|
@ -289,7 +289,6 @@ static int setup_remotes_and_fetch(
|
|||||||
}
|
}
|
||||||
git_remote_disconnect(origin);
|
git_remote_disconnect(origin);
|
||||||
}
|
}
|
||||||
git_remote_free(origin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return retcode;
|
return retcode;
|
||||||
|
@ -17,6 +17,12 @@ void test_clone_network__initialize(void)
|
|||||||
cl_git_pass(git_remote_new(&g_origin, NULL, "origin", LIVE_REPO_URL, GIT_REMOTE_DEFAULT_FETCH));
|
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);
|
||||||
|
g_origin = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void cleanup_repository(void *path)
|
static void cleanup_repository(void *path)
|
||||||
{
|
{
|
||||||
if (g_repo) {
|
if (g_repo) {
|
||||||
|
@ -14,6 +14,12 @@ void test_clone_nonetwork__initialize(void)
|
|||||||
cl_git_pass(git_remote_new(&g_origin, NULL, "origin", cl_git_fixture_url("testrepo.git"), GIT_REMOTE_DEFAULT_FETCH));
|
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);
|
||||||
|
g_origin = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void cleanup_repository(void *path)
|
static void cleanup_repository(void *path)
|
||||||
{
|
{
|
||||||
if (g_repo) {
|
if (g_repo) {
|
||||||
@ -56,7 +62,6 @@ void test_clone_nonetwork__fail_when_the_target_is_a_file(void)
|
|||||||
|
|
||||||
cl_git_mkfile("./foo", "Bar!");
|
cl_git_mkfile("./foo", "Bar!");
|
||||||
cl_git_fail(git_clone(&g_repo, g_origin, "./foo", NULL, NULL, NULL));
|
cl_git_fail(git_clone(&g_repo, g_origin, "./foo", NULL, NULL, NULL));
|
||||||
git_remote_free(g_origin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_clone_nonetwork__fail_with_already_existing_but_non_empty_directory(void)
|
void test_clone_nonetwork__fail_with_already_existing_but_non_empty_directory(void)
|
||||||
@ -66,5 +71,4 @@ void test_clone_nonetwork__fail_with_already_existing_but_non_empty_directory(vo
|
|||||||
p_mkdir("./foo", GIT_DIR_MODE);
|
p_mkdir("./foo", GIT_DIR_MODE);
|
||||||
cl_git_mkfile("./foo/bar", "Baz!");
|
cl_git_mkfile("./foo/bar", "Baz!");
|
||||||
cl_git_fail(git_clone(&g_repo, g_origin, "./foo", NULL, NULL, NULL));
|
cl_git_fail(git_clone(&g_repo, g_origin, "./foo", NULL, NULL, NULL));
|
||||||
git_remote_free(g_origin);
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user