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
fdc7e5e3
Commit
fdc7e5e3
authored
Sep 20, 2013
by
Carlos Martín Nieto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clone: bring back NULL as defaults
This wasremoved as part of the large culling a few commits ago.
parent
c833893c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
src/clone.c
+9
-5
tests-clar/clone/nonetwork.c
+6
-0
No files found.
src/clone.c
View file @
fdc7e5e3
...
...
@@ -390,16 +390,20 @@ int git_clone(
git_repository
**
out
,
const
char
*
url
,
const
char
*
local_path
,
const
git_clone_options
*
options
)
const
git_clone_options
*
_
options
)
{
int
retcode
=
GIT_ERROR
;
git_repository
*
repo
=
NULL
;
git_remote
*
origin
;
git_clone_options
options
=
GIT_CLONE_OPTIONS_INIT
;
int
remove_directory_on_failure
=
0
;
assert
(
out
&&
url
&&
local_path
);
GITERR_CHECK_VERSION
(
options
,
GIT_CLONE_OPTIONS_VERSION
,
"git_clone_options"
);
if
(
_options
)
memcpy
(
&
options
,
_options
,
sizeof
(
git_clone_options
));
GITERR_CHECK_VERSION
(
&
options
,
GIT_CLONE_OPTIONS_VERSION
,
"git_clone_options"
);
/* Only clone to a new directory or an empty directory */
if
(
git_path_exists
(
local_path
)
&&
!
git_path_is_empty_dir
(
local_path
))
{
...
...
@@ -411,13 +415,13 @@ int git_clone(
/* Only remove the directory on failure if we create it */
remove_directory_on_failure
=
!
git_path_exists
(
local_path
);
if
((
retcode
=
git_repository_init
(
&
repo
,
local_path
,
options
->
bare
))
<
0
)
if
((
retcode
=
git_repository_init
(
&
repo
,
local_path
,
options
.
bare
))
<
0
)
return
retcode
;
if
((
retcode
=
create_and_configure_origin
(
&
origin
,
repo
,
url
,
options
))
<
0
)
if
((
retcode
=
create_and_configure_origin
(
&
origin
,
repo
,
url
,
&
options
))
<
0
)
goto
cleanup
;
retcode
=
git_clone_into
(
repo
,
origin
,
&
options
->
checkout_opts
,
options
->
checkout_branch
);
retcode
=
git_clone_into
(
repo
,
origin
,
&
options
.
checkout_opts
,
options
.
checkout_branch
);
git_remote_free
(
origin
);
if
(
retcode
<
0
)
...
...
tests-clar/clone/nonetwork.c
View file @
fdc7e5e3
...
...
@@ -130,6 +130,12 @@ void test_clone_nonetwork__custom_origin_name(void)
cl_git_pass
(
git_remote_load
(
&
g_remote
,
g_repo
,
"my_origin"
));
}
void
test_clone_nonetwork__defaults
(
void
)
{
cl_git_pass
(
git_clone
(
&
g_repo
,
cl_git_fixture_url
(
"testrepo.git"
),
"./foo"
,
NULL
));
cl_assert
(
g_repo
);
cl_git_pass
(
git_remote_load
(
&
g_remote
,
g_repo
,
"origin"
));
}
void
test_clone_nonetwork__cope_with_already_existing_directory
(
void
)
{
...
...
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