Skip to content

Commit 7314da1

Browse files
committed
examples: fix warnings in network/fetch.c
1 parent e2d1b7e commit 7314da1

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

examples/network/fetch.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ static int update_cb(const char *refname, const git_oid *a, const git_oid *b, vo
5555
*/
5656
static int transfer_progress_cb(const git_transfer_progress *stats, void *payload)
5757
{
58+
(void)payload;
59+
5860
if (stats->received_objects == stats->total_objects) {
5961
printf("Resolving deltas %d/%d\r",
6062
stats->indexed_deltas, stats->total_deltas);
@@ -71,22 +73,20 @@ int fetch(git_repository *repo, int argc, char **argv)
7173
{
7274
git_remote *remote = NULL;
7375
const git_transfer_progress *stats;
74-
struct dl_data data;
7576
git_fetch_options fetch_opts = GIT_FETCH_OPTIONS_INIT;
7677

7778
if (argc < 2) {
7879
fprintf(stderr, "usage: %s fetch <repo>\n", argv[-1]);
7980
return EXIT_FAILURE;
8081
}
8182

82-
// Figure out whether it's a named remote or a URL
83+
/* Figure out whether it's a named remote or a URL */
8384
printf("Fetching %s for repo %p\n", argv[1], repo);
84-
if (git_remote_lookup(&remote, repo, argv[1]) < 0) {
85+
if (git_remote_lookup(&remote, repo, argv[1]) < 0)
8586
if (git_remote_create_anonymous(&remote, repo, argv[1]) < 0)
86-
return -1;
87-
}
87+
goto on_error;
8888

89-
// Set up the callbacks (only update_tips for now)
89+
/* Set up the callbacks (only update_tips for now) */
9090
fetch_opts.callbacks.update_tips = &update_cb;
9191
fetch_opts.callbacks.sideband_progress = &progress_cb;
9292
fetch_opts.callbacks.transfer_progress = transfer_progress_cb;
@@ -98,7 +98,7 @@ int fetch(git_repository *repo, int argc, char **argv)
9898
* "fetch".
9999
*/
100100
if (git_remote_fetch(remote, NULL, &fetch_opts, "fetch") < 0)
101-
return -1;
101+
goto on_error;
102102

103103
/**
104104
* If there are local objects (we got a thin pack), then tell

0 commit comments

Comments
 (0)