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
adcdeb36
Commit
adcdeb36
authored
Aug 01, 2014
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
online::clone::credentials support default credentials
parent
f96e7e6c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
1 deletions
+24
-1
tests/online/clone.c
+24
-1
No files found.
tests/online/clone.c
View file @
adcdeb36
...
@@ -226,9 +226,28 @@ void test_online_clone__cred_callback_failure_return_code_is_tunnelled(void)
...
@@ -226,9 +226,28 @@ void test_online_clone__cred_callback_failure_return_code_is_tunnelled(void)
cl_git_fail_with
(
git_clone
(
&
g_repo
,
remote_url
,
"./foo"
,
&
g_options
),
-
1
);
cl_git_fail_with
(
git_clone
(
&
g_repo
,
remote_url
,
"./foo"
,
&
g_options
),
-
1
);
}
}
int
cred_default
(
git_cred
**
cred
,
const
char
*
url
,
const
char
*
user_from_url
,
unsigned
int
allowed_types
,
void
*
payload
)
{
GIT_UNUSED
(
url
);
GIT_UNUSED
(
user_from_url
);
GIT_UNUSED
(
payload
);
if
(
!
(
allowed_types
&
GIT_CREDTYPE_DEFAULT
))
return
0
;
return
git_cred_default_new
(
cred
);
}
void
test_online_clone__credentials
(
void
)
void
test_online_clone__credentials
(
void
)
{
{
/* Remote URL environment variable must be set. User and password are optional. */
/* Remote URL environment variable must be set.
* User and password are optional.
*/
const
char
*
remote_url
=
cl_getenv
(
"GITTEST_REMOTE_URL"
);
const
char
*
remote_url
=
cl_getenv
(
"GITTEST_REMOTE_URL"
);
git_cred_userpass_payload
user_pass
=
{
git_cred_userpass_payload
user_pass
=
{
cl_getenv
(
"GITTEST_REMOTE_USER"
),
cl_getenv
(
"GITTEST_REMOTE_USER"
),
...
@@ -237,8 +256,12 @@ void test_online_clone__credentials(void)
...
@@ -237,8 +256,12 @@ void test_online_clone__credentials(void)
if
(
!
remote_url
)
return
;
if
(
!
remote_url
)
return
;
if
(
cl_getenv
(
"GITTEST_REMOTE_DEFAULT"
))
{
g_options
.
remote_callbacks
.
credentials
=
cred_default
;
}
else
{
g_options
.
remote_callbacks
.
credentials
=
git_cred_userpass
;
g_options
.
remote_callbacks
.
credentials
=
git_cred_userpass
;
g_options
.
remote_callbacks
.
payload
=
&
user_pass
;
g_options
.
remote_callbacks
.
payload
=
&
user_pass
;
}
cl_git_pass
(
git_clone
(
&
g_repo
,
remote_url
,
"./foo"
,
&
g_options
));
cl_git_pass
(
git_clone
(
&
g_repo
,
remote_url
,
"./foo"
,
&
g_options
));
git_repository_free
(
g_repo
);
g_repo
=
NULL
;
git_repository_free
(
g_repo
);
g_repo
=
NULL
;
...
...
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