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
31985775
Unverified
Commit
31985775
authored
Mar 19, 2018
by
Edward Thomson
Committed by
GitHub
Mar 19, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4584 from libgit2/ethomson/bitbucket
online::clone: skip creds fallback test
parents
937e7e26
03c58778
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
4 deletions
+34
-4
tests/online/clone.c
+34
-4
No files found.
tests/online/clone.c
View file @
31985775
...
@@ -357,15 +357,45 @@ void test_online_clone__bitbucket_style(void)
...
@@ -357,15 +357,45 @@ void test_online_clone__bitbucket_style(void)
cl_git_pass
(
git_clone
(
&
g_repo
,
BB_REPO_URL
,
"./foo"
,
&
g_options
));
cl_git_pass
(
git_clone
(
&
g_repo
,
BB_REPO_URL
,
"./foo"
,
&
g_options
));
git_repository_free
(
g_repo
);
g_repo
=
NULL
;
git_repository_free
(
g_repo
);
g_repo
=
NULL
;
cl_fixture_cleanup
(
"./foo"
);
cl_fixture_cleanup
(
"./foo"
);
}
/* User and pass from URL */
void
test_online_clone__bitbucket_uses_creds_in_url
(
void
)
user_pass
.
password
=
"wrong"
;
{
git_cred_userpass_payload
user_pass
=
{
"libgit2"
,
"wrong"
};
g_options
.
fetch_opts
.
callbacks
.
credentials
=
git_cred_userpass
;
g_options
.
fetch_opts
.
callbacks
.
payload
=
&
user_pass
;
/*
* Correct user and pass are in the URL; the (incorrect) creds in
* the `git_cred_userpass_payload` should be ignored.
*/
cl_git_pass
(
git_clone
(
&
g_repo
,
BB_REPO_URL_WITH_PASS
,
"./foo"
,
&
g_options
));
cl_git_pass
(
git_clone
(
&
g_repo
,
BB_REPO_URL_WITH_PASS
,
"./foo"
,
&
g_options
));
git_repository_free
(
g_repo
);
g_repo
=
NULL
;
git_repository_free
(
g_repo
);
g_repo
=
NULL
;
cl_fixture_cleanup
(
"./foo"
);
cl_fixture_cleanup
(
"./foo"
);
}
/* Wrong password in URL, fall back to user_pass */
void
test_online_clone__bitbucket_falls_back_to_specified_creds
(
void
)
user_pass
.
password
=
"libgit2"
;
{
git_cred_userpass_payload
user_pass
=
{
"libgit2"
,
"libgit2"
};
g_options
.
fetch_opts
.
callbacks
.
credentials
=
git_cred_userpass
;
g_options
.
fetch_opts
.
callbacks
.
payload
=
&
user_pass
;
/*
* TODO: as of March 2018, bitbucket sporadically fails with
* 403s instead of replying with a 401 - but only sometimes.
*/
cl_skip
();
/*
* Incorrect user and pass are in the URL; the (correct) creds in
* the `git_cred_userpass_payload` should be used as a fallback.
*/
cl_git_pass
(
git_clone
(
&
g_repo
,
BB_REPO_URL_WITH_WRONG_PASS
,
"./foo"
,
&
g_options
));
cl_git_pass
(
git_clone
(
&
g_repo
,
BB_REPO_URL_WITH_WRONG_PASS
,
"./foo"
,
&
g_options
));
git_repository_free
(
g_repo
);
g_repo
=
NULL
;
git_repository_free
(
g_repo
);
g_repo
=
NULL
;
cl_fixture_cleanup
(
"./foo"
);
cl_fixture_cleanup
(
"./foo"
);
...
...
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