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
cbb2fede
Commit
cbb2fede
authored
Sep 27, 2011
by
Carlos Martín Nieto
Committed by
Vicent Marti
Oct 12, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http: add a set of common refs
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
parent
3313a05a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
14 deletions
+40
-14
src/transport-http.c
+40
-14
No files found.
src/transport-http.c
View file @
cbb2fede
...
...
@@ -394,8 +394,9 @@ static int http_negotiate_fetch(git_transport *transport, git_repository *repo,
unsigned
int
i
;
char
buff
[
128
];
gitno_buffer
buf
;
git_revwalk
*
walk
;
git_oid
oid
;
git_revwalk
*
walk
=
NULL
;
git_oid
oid
,
*
poid
;
git_vector
common
;
const
char
*
prefix
=
"http://"
,
*
url
=
t
->
parent
.
url
;
git_buf
request
=
GIT_BUF_INIT
;
gitno_buffer_setup
(
&
buf
,
buff
,
sizeof
(
buff
),
t
->
socket
);
...
...
@@ -404,39 +405,64 @@ static int http_negotiate_fetch(git_transport *transport, git_repository *repo,
if
(
!
git__prefixcmp
(
url
,
prefix
))
url
+=
strlen
(
prefix
);
error
=
setup_walk
(
&
walk
,
repo
);
error
=
git_vector_init
(
&
common
,
16
,
NULL
);
if
(
error
<
GIT_SUCCESS
)
return
git__rethrow
(
error
,
"Failed to setup walk"
);
return
git__rethrow
(
error
,
"Failed to init common vector"
);
error
=
setup_walk
(
&
walk
,
repo
);
if
(
error
<
GIT_SUCCESS
)
{
error
=
git__rethrow
(
error
,
"Failed to setup walk"
);
goto
cleanup
;
}
do
{
error
=
do_connect
(
t
,
t
->
host
,
t
->
port
);
if
(
error
<
GIT_SUCCESS
)
return
git__rethrow
(
error
,
"Failed to connect to host"
);
if
(
error
<
GIT_SUCCESS
)
{
error
=
git__rethrow
(
error
,
"Failed to connect to host"
);
goto
cleanup
;
}
error
=
gen_request
(
&
request
,
url
,
t
->
host
,
"POST"
,
"upload-pack"
);
if
(
error
<
GIT_SUCCESS
)
return
git__rethrow
(
error
,
"Failed to generate request"
);
if
(
error
<
GIT_SUCCESS
)
{
error
=
git__rethrow
(
error
,
"Failed to generate request"
);
goto
cleanup
;
}
error
=
gitno_send
(
t
->
socket
,
request
.
ptr
,
request
.
size
,
0
);
if
(
error
<
GIT_SUCCESS
)
return
git__rethrow
(
error
,
"Failed to send request"
);
if
(
error
<
GIT_SUCCESS
)
{
error
=
git__rethrow
(
error
,
"Failed to send request"
);
goto
cleanup
;
}
error
=
git_pkt_send_wants
(
wants
,
&
t
->
caps
,
t
->
socket
,
1
);
if
(
error
<
GIT_SUCCESS
)
return
git__rethrow
(
error
,
"Failed to send wants"
);
if
(
error
<
GIT_SUCCESS
)
{
error
=
git__rethrow
(
error
,
"Failed to send wants"
);
goto
cleanup
;
}
/* We need to send these on each connection */
git_vector_foreach
(
&
common
,
i
,
poid
)
{
error
=
git_pkt_send_have
(
poid
,
t
->
socket
,
1
);
if
(
error
<
GIT_SUCCESS
)
{
error
=
git__rethrow
(
error
,
"Failed to send common have"
);
goto
cleanup
;
}
}
i
=
0
;
while
((
error
=
git_revwalk_next
(
&
oid
,
walk
))
==
GIT_SUCCESS
)
{
error
=
git_pkt_send_have
(
&
oid
,
t
->
socket
,
1
);
if
(
error
<
GIT_SUCCESS
)
return
git__rethrow
(
error
,
"Failed to send have"
);
if
(
error
<
GIT_SUCCESS
)
{
error
=
git__rethrow
(
error
,
"Failed to send have"
);
goto
cleanup
;
}
i
++
;
}
if
(
error
<
GIT_SUCCESS
||
i
>=
256
)
break
;
}
while
(
1
);
cleanup:
git_revwalk_free
(
walk
);
return
error
;
}
...
...
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