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
7314da10
Commit
7314da10
authored
Aug 16, 2016
by
Patrick Steinhardt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
examples: fix warnings in network/fetch.c
parent
e2d1b7ec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
examples/network/fetch.c
+7
-7
No files found.
examples/network/fetch.c
View file @
7314da10
...
...
@@ -55,6 +55,8 @@ static int update_cb(const char *refname, const git_oid *a, const git_oid *b, vo
*/
static
int
transfer_progress_cb
(
const
git_transfer_progress
*
stats
,
void
*
payload
)
{
(
void
)
payload
;
if
(
stats
->
received_objects
==
stats
->
total_objects
)
{
printf
(
"Resolving deltas %d/%d
\r
"
,
stats
->
indexed_deltas
,
stats
->
total_deltas
);
...
...
@@ -71,7 +73,6 @@ int fetch(git_repository *repo, int argc, char **argv)
{
git_remote
*
remote
=
NULL
;
const
git_transfer_progress
*
stats
;
struct
dl_data
data
;
git_fetch_options
fetch_opts
=
GIT_FETCH_OPTIONS_INIT
;
if
(
argc
<
2
)
{
...
...
@@ -79,14 +80,13 @@ int fetch(git_repository *repo, int argc, char **argv)
return
EXIT_FAILURE
;
}
/
/ Figure out whether it's a named remote or a URL
/
* Figure out whether it's a named remote or a URL */
printf
(
"Fetching %s for repo %p
\n
"
,
argv
[
1
],
repo
);
if
(
git_remote_lookup
(
&
remote
,
repo
,
argv
[
1
])
<
0
)
{
if
(
git_remote_lookup
(
&
remote
,
repo
,
argv
[
1
])
<
0
)
if
(
git_remote_create_anonymous
(
&
remote
,
repo
,
argv
[
1
])
<
0
)
return
-
1
;
}
goto
on_error
;
/
/ Set up the callbacks (only update_tips for now)
/
* Set up the callbacks (only update_tips for now) */
fetch_opts
.
callbacks
.
update_tips
=
&
update_cb
;
fetch_opts
.
callbacks
.
sideband_progress
=
&
progress_cb
;
fetch_opts
.
callbacks
.
transfer_progress
=
transfer_progress_cb
;
...
...
@@ -98,7 +98,7 @@ int fetch(git_repository *repo, int argc, char **argv)
* "fetch".
*/
if
(
git_remote_fetch
(
remote
,
NULL
,
&
fetch_opts
,
"fetch"
)
<
0
)
return
-
1
;
goto
on_error
;
/**
* If there are local objects (we got a thin pack), then tell
...
...
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