examples: fix warnings in network/fetch.c
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
diff --git a/examples/network/fetch.c b/examples/network/fetch.c
index 177359b..10974a9 100644
--- a/examples/network/fetch.c
+++ b/examples/network/fetch.c
@@ -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