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
b5b28120
Commit
b5b28120
authored
Jan 12, 2013
by
Sascha Cunz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test: Cleanup some cleaning code
parent
1265b51f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
23 deletions
+20
-23
tests-clar/clone/nonetwork.c
+20
-23
No files found.
tests-clar/clone/nonetwork.c
View file @
b5b28120
...
...
@@ -7,6 +7,8 @@
static
git_clone_options
g_options
;
static
git_repository
*
g_repo
;
static
git_reference
*
g_ref
;
static
git_remote
*
g_remote
;
void
test_clone_nonetwork__initialize
(
void
)
{
...
...
@@ -27,6 +29,16 @@ void test_clone_nonetwork__cleanup(void)
g_repo
=
NULL
;
}
if
(
g_ref
)
{
git_reference_free
(
g_ref
);
g_ref
=
NULL
;
}
if
(
g_remote
)
{
git_remote_free
(
g_remote
);
g_remote
=
NULL
;
}
cl_fixture_cleanup
(
"./foo"
);
}
...
...
@@ -73,66 +85,51 @@ void test_clone_nonetwork__fail_with_already_existing_but_non_empty_directory(vo
void
test_clone_nonetwork__custom_origin_name
(
void
)
{
git_remote
*
remote
;
g_options
.
remote_name
=
"my_origin"
;
cl_git_pass
(
git_clone
(
&
g_repo
,
cl_git_fixture_url
(
"testrepo.git"
),
"./foo"
,
&
g_options
));
cl_git_pass
(
git_remote_load
(
&
remote
,
g_repo
,
"my_origin"
));
git_remote_free
(
remote
);
cl_git_pass
(
git_remote_load
(
&
g_remote
,
g_repo
,
"my_origin"
));
}
void
test_clone_nonetwork__custom_push_url
(
void
)
{
git_remote
*
remote
;
const
char
*
url
=
"http://example.com"
;
g_options
.
pushurl
=
url
;
cl_git_pass
(
git_clone
(
&
g_repo
,
cl_git_fixture_url
(
"testrepo.git"
),
"./foo"
,
&
g_options
));
cl_git_pass
(
git_remote_load
(
&
remote
,
g_repo
,
"origin"
));
cl_assert_equal_s
(
url
,
git_remote_pushurl
(
remote
));
git_remote_free
(
remote
);
cl_git_pass
(
git_remote_load
(
&
g_remote
,
g_repo
,
"origin"
));
cl_assert_equal_s
(
url
,
git_remote_pushurl
(
g_remote
));
}
void
test_clone_nonetwork__custom_fetch_spec
(
void
)
{
git_remote
*
remote
;
git_reference
*
master
;
const
git_refspec
*
actual_fs
;
const
char
*
spec
=
"+refs/heads/master:refs/heads/foo"
;
g_options
.
fetch_spec
=
spec
;
cl_git_pass
(
git_clone
(
&
g_repo
,
cl_git_fixture_url
(
"testrepo.git"
),
"./foo"
,
&
g_options
));
cl_git_pass
(
git_remote_load
(
&
remote
,
g_repo
,
"origin"
));
actual_fs
=
git_remote_fetchspec
(
remote
);
cl_git_pass
(
git_remote_load
(
&
g_
remote
,
g_repo
,
"origin"
));
actual_fs
=
git_remote_fetchspec
(
g_
remote
);
cl_assert_equal_s
(
"refs/heads/master"
,
git_refspec_src
(
actual_fs
));
cl_assert_equal_s
(
"refs/heads/foo"
,
git_refspec_dst
(
actual_fs
));
cl_git_pass
(
git_reference_lookup
(
&
master
,
g_repo
,
"refs/heads/foo"
));
git_reference_free
(
master
);
git_remote_free
(
remote
);
cl_git_pass
(
git_reference_lookup
(
&
g_ref
,
g_repo
,
"refs/heads/foo"
));
}
void
test_clone_nonetwork__custom_push_spec
(
void
)
{
git_remote
*
remote
;
const
git_refspec
*
actual_fs
;
const
char
*
spec
=
"+refs/heads/master:refs/heads/foo"
;
g_options
.
push_spec
=
spec
;
cl_git_pass
(
git_clone
(
&
g_repo
,
cl_git_fixture_url
(
"testrepo.git"
),
"./foo"
,
&
g_options
));
cl_git_pass
(
git_remote_load
(
&
remote
,
g_repo
,
"origin"
));
actual_fs
=
git_remote_pushspec
(
remote
);
cl_git_pass
(
git_remote_load
(
&
g_
remote
,
g_repo
,
"origin"
));
actual_fs
=
git_remote_pushspec
(
g_
remote
);
cl_assert_equal_s
(
"refs/heads/master"
,
git_refspec_src
(
actual_fs
));
cl_assert_equal_s
(
"refs/heads/foo"
,
git_refspec_dst
(
actual_fs
));
git_remote_free
(
remote
);
}
void
test_clone_nonetwork__custom_autotag
(
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