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
c49126c8
Commit
c49126c8
authored
Sep 10, 2015
by
Matt Burke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Accept custom headers for fetch too
parent
c82c2ba6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
include/git2/remote.h
+5
-0
src/remote.c
+6
-2
No files found.
include/git2/remote.h
View file @
c49126c8
...
...
@@ -547,6 +547,11 @@ typedef struct {
* The default is to auto-follow tags.
*/
git_remote_autotag_option_t
download_tags
;
/**
* Extra headers for this fetch operation
*/
git_strarray
custom_headers
;
}
git_fetch_options
;
#define GIT_FETCH_OPTIONS_VERSION 1
...
...
src/remote.c
View file @
c49126c8
...
...
@@ -895,16 +895,18 @@ int git_remote_download(git_remote *remote, const git_strarray *refspecs, const
size_t
i
;
git_vector
*
to_active
,
specs
=
GIT_VECTOR_INIT
,
refs
=
GIT_VECTOR_INIT
;
const
git_remote_callbacks
*
cbs
=
NULL
;
const
git_strarray
*
custom_headers
=
NULL
;
assert
(
remote
);
if
(
opts
)
{
GITERR_CHECK_VERSION
(
&
opts
->
callbacks
,
GIT_REMOTE_CALLBACKS_VERSION
,
"git_remote_callbacks"
);
cbs
=
&
opts
->
callbacks
;
custom_headers
=
&
opts
->
custom_headers
;
}
if
(
!
git_remote_connected
(
remote
)
&&
(
error
=
git_remote_connect
(
remote
,
GIT_DIRECTION_FETCH
,
cbs
,
NULL
))
<
0
)
(
error
=
git_remote_connect
(
remote
,
GIT_DIRECTION_FETCH
,
cbs
,
custom_headers
))
<
0
)
goto
on_error
;
if
(
ls_to_vector
(
&
refs
,
remote
)
<
0
)
...
...
@@ -968,16 +970,18 @@ int git_remote_fetch(
bool
prune
=
false
;
git_buf
reflog_msg_buf
=
GIT_BUF_INIT
;
const
git_remote_callbacks
*
cbs
=
NULL
;
const
git_strarray
*
custom_headers
=
NULL
;
if
(
opts
)
{
GITERR_CHECK_VERSION
(
&
opts
->
callbacks
,
GIT_REMOTE_CALLBACKS_VERSION
,
"git_remote_callbacks"
);
cbs
=
&
opts
->
callbacks
;
custom_headers
=
&
opts
->
custom_headers
;
update_fetchhead
=
opts
->
update_fetchhead
;
tagopt
=
opts
->
download_tags
;
}
/* Connect and download everything */
if
((
error
=
git_remote_connect
(
remote
,
GIT_DIRECTION_FETCH
,
cbs
,
NULL
))
!=
0
)
if
((
error
=
git_remote_connect
(
remote
,
GIT_DIRECTION_FETCH
,
cbs
,
custom_headers
))
!=
0
)
return
error
;
error
=
git_remote_download
(
remote
,
refspecs
,
opts
);
...
...
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