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
5f10853e
Commit
5f10853e
authored
Jan 30, 2013
by
Ben Straub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip "user@" when finding hostname in url
parent
5f9f69d9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
src/netops.c
+6
-2
tests-clar/online/clone.c
+17
-0
No files found.
src/netops.c
View file @
5f10853e
...
...
@@ -580,10 +580,12 @@ int gitno_select_in(gitno_buffer *buf, long int sec, long int usec)
int
gitno_extract_host_and_port
(
char
**
host
,
char
**
port
,
const
char
*
url
,
const
char
*
default_port
)
{
char
*
colon
,
*
slash
,
*
delim
;
char
*
colon
,
*
slash
,
*
at
,
*
delim
;
const
char
*
start
;
colon
=
strchr
(
url
,
':'
);
slash
=
strchr
(
url
,
'/'
);
at
=
strchr
(
url
,
'@'
);
if
(
slash
==
NULL
)
{
giterr_set
(
GITERR_NET
,
"Malformed URL: missing /"
);
...
...
@@ -598,7 +600,9 @@ int gitno_extract_host_and_port(char **host, char **port, const char *url, const
GITERR_CHECK_ALLOC
(
*
port
);
delim
=
colon
==
NULL
?
slash
:
colon
;
*
host
=
git__strndup
(
url
,
delim
-
url
);
start
=
at
==
NULL
&&
at
<
slash
?
url
:
at
+
1
;
*
host
=
git__strndup
(
start
,
delim
-
start
);
GITERR_CHECK_ALLOC
(
*
host
);
return
0
;
...
...
tests-clar/online/clone.c
View file @
5f10853e
...
...
@@ -6,6 +6,7 @@
#define LIVE_REPO_URL "http://github.com/libgit2/TestGitRepository"
#define LIVE_EMPTYREPO_URL "http://github.com/libgit2/TestEmptyRepository"
#define BB_REPO_URL "https://libgit2@bitbucket.org/libgit2/testgitrepository.git"
static
git_repository
*
g_repo
;
static
git_clone_options
g_options
;
...
...
@@ -150,4 +151,20 @@ void test_online_clone__credentials(void)
g_options
.
cred_acquire_payload
=
&
user_pass
;
cl_git_pass
(
git_clone
(
&
g_repo
,
remote_url
,
"./foo"
,
&
g_options
));
git_repository_free
(
g_repo
);
g_repo
=
NULL
;
cl_fixture_cleanup
(
"./foo"
);
}
void
test_online_clone__bitbucket_style
(
void
)
{
git_cred_userpass_payload
user_pass
=
{
"libgit2"
,
"libgit2"
};
g_options
.
cred_acquire_cb
=
git_cred_userpass
;
g_options
.
cred_acquire_payload
=
&
user_pass
;
cl_git_pass
(
git_clone
(
&
g_repo
,
BB_REPO_URL
,
"./foo"
,
&
g_options
));
git_repository_free
(
g_repo
);
g_repo
=
NULL
;
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