Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
24393ea6
Commit
24393ea6
authored
Dec 13, 2012
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Stop premature remote freeing when cloning
parent
34c8c754
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
3 deletions
+13
-3
examples/network/clone.c
+1
-0
src/clone.c
+0
-1
tests-clar/clone/network.c
+6
-0
tests-clar/clone/nonetwork.c
+6
-2
No files found.
examples/network/clone.c
View file @
24393ea6
...
@@ -82,6 +82,7 @@ int do_clone(git_repository *repo, int argc, char **argv)
...
@@ -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
();
...
...
src/clone.c
View file @
24393ea6
...
@@ -289,7 +289,6 @@ static int setup_remotes_and_fetch(
...
@@ -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
;
...
...
tests-clar/clone/network.c
View file @
24393ea6
...
@@ -17,6 +17,12 @@ void test_clone_network__initialize(void)
...
@@ -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
)
{
...
...
tests-clar/clone/nonetwork.c
View file @
24393ea6
...
@@ -14,6 +14,12 @@ void test_clone_nonetwork__initialize(void)
...
@@ -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)
...
@@ -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
...
@@ -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
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment