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
eff5b499
Commit
eff5b499
authored
Jul 25, 2012
by
Sascha Cunz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remotes: Use correct url in git_remote_connect
parent
413d5563
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
1 deletions
+34
-1
src/remote.c
+20
-1
src/remote.h
+2
-0
tests-clar/network/remotes.c
+12
-0
No files found.
src/remote.c
View file @
eff5b499
...
...
@@ -356,13 +356,32 @@ const git_refspec *git_remote_pushspec(git_remote *remote)
return
&
remote
->
push
;
}
const
char
*
git_remote__urlfordirection
(
git_remote
*
remote
,
int
direction
)
{
assert
(
remote
);
if
(
direction
==
GIT_DIR_FETCH
)
{
return
remote
->
url
;
}
if
(
direction
==
GIT_DIR_PUSH
)
{
return
remote
->
pushurl
?
remote
->
pushurl
:
remote
->
url
;
}
return
NULL
;
}
int
git_remote_connect
(
git_remote
*
remote
,
int
direction
)
{
git_transport
*
t
;
assert
(
remote
);
if
(
git_transport_new
(
&
t
,
remote
->
url
)
<
0
)
const
char
*
url
=
git_remote__urlfordirection
(
remote
,
direction
);
if
(
url
==
NULL
)
return
-
1
;
if
(
git_transport_new
(
&
t
,
url
)
<
0
)
return
-
1
;
t
->
check_cert
=
remote
->
check_cert
;
...
...
src/remote.h
View file @
eff5b499
...
...
@@ -24,4 +24,6 @@ struct git_remote {
check_cert
;
};
const
char
*
git_remote__urlfordirection
(
struct
git_remote
*
remote
,
int
direction
);
#endif
tests-clar/network/remotes.c
View file @
eff5b499
...
...
@@ -2,6 +2,7 @@
#include "buffer.h"
#include "refspec.h"
#include "transport.h"
#include "remote.h"
static
git_remote
*
_remote
;
static
git_repository
*
_repo
;
...
...
@@ -33,10 +34,21 @@ void test_network_remotes__parsing(void)
cl_assert_equal_s
(
git_remote_url
(
_remote
),
"git://github.com/libgit2/libgit2"
);
cl_assert
(
git_remote_pushurl
(
_remote
)
==
NULL
);
cl_assert_equal_s
(
git_remote__urlfordirection
(
_remote
,
GIT_DIR_FETCH
),
"git://github.com/libgit2/libgit2"
);
cl_assert_equal_s
(
git_remote__urlfordirection
(
_remote
,
GIT_DIR_PUSH
),
"git://github.com/libgit2/libgit2"
);
cl_git_pass
(
git_remote_load
(
&
_remote2
,
_repo
,
"test_with_pushurl"
));
cl_assert_equal_s
(
git_remote_name
(
_remote2
),
"test_with_pushurl"
);
cl_assert_equal_s
(
git_remote_url
(
_remote2
),
"git://github.com/libgit2/fetchlibgit2"
);
cl_assert_equal_s
(
git_remote_pushurl
(
_remote2
),
"git://github.com/libgit2/pushlibgit2"
);
cl_assert_equal_s
(
git_remote__urlfordirection
(
_remote2
,
GIT_DIR_FETCH
),
"git://github.com/libgit2/fetchlibgit2"
);
cl_assert_equal_s
(
git_remote__urlfordirection
(
_remote2
,
GIT_DIR_PUSH
),
"git://github.com/libgit2/pushlibgit2"
);
git_remote_free
(
_remote2
);
}
...
...
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