diff --git a/examples/network/clone.c b/examples/network/clone.c index 6f98192cc..791600171 100644 --- a/examples/network/clone.c +++ b/examples/network/clone.c @@ -8,7 +8,7 @@ #include typedef struct progress_data { - git_indexer_stats fetch_progress; + git_transfer_progress fetch_progress; size_t completed_steps; size_t total_steps; const char *path; @@ -16,20 +16,21 @@ typedef struct progress_data { static void print_progress(const progress_data *pd) { - int network_percent = (100*pd->fetch_progress.received) / pd->fetch_progress.total; - int index_percent = (100*pd->fetch_progress.processed) / pd->fetch_progress.total; + int network_percent = (100*pd->fetch_progress.received_objects) / pd->fetch_progress.total_objects; + int index_percent = (100*pd->fetch_progress.indexed_objects) / pd->fetch_progress.total_objects; int checkout_percent = pd->total_steps > 0 ? (100 * pd->completed_steps) / pd->total_steps : 0.f; - int kbytes = pd->fetch_progress.bytes / 1024; + int kbytes = pd->fetch_progress.received_bytes / 1024; printf("net %3d%% (%4d kb, %5d/%5d) / idx %3d%% (%5d/%5d) / chk %3d%% (%4lu/%4lu) %s\n", - network_percent, kbytes, pd->fetch_progress.received, pd->fetch_progress.total, - index_percent, pd->fetch_progress.processed, pd->fetch_progress.total, + network_percent, kbytes, + pd->fetch_progress.received_objects, pd->fetch_progress.total_objects, + index_percent, pd->fetch_progress.indexed_objects, pd->fetch_progress.total_objects, checkout_percent, pd->completed_steps, pd->total_steps, pd->path); } -static void fetch_progress(const git_indexer_stats *stats, void *payload) +static void fetch_progress(const git_transfer_progress *stats, void *payload) { progress_data *pd = (progress_data*)payload; pd->fetch_progress = *stats; diff --git a/examples/network/fetch.c b/examples/network/fetch.c index 39cb0deb8..8bfe10c5c 100644 --- a/examples/network/fetch.c +++ b/examples/network/fetch.c @@ -105,16 +105,18 @@ int fetch(git_repository *repo, int argc, char **argv) do { usleep(10000); - if (stats->total > 0) + if (stats->total_objects > 0) printf("Received %d/%d objects (%d) in %d bytes\r", - stats->received, stats->total, stats->processed, bytes); + stats->received_objects, stats->total_objects, + stats->indexed_objects, bytes); } while (!data.finished); if (data.ret < 0) goto on_error; pthread_join(worker, NULL); - printf("\rReceived %d/%d objects in %zu bytes\n", stats->processed, stats->total, bytes); + printf("\rReceived %d/%d objects in %zu bytes\n", + stats->indexed_objects, stats->total_objects, bytes); // Disconnect the underlying connection to prevent from idling. git_remote_disconnect(remote); diff --git a/examples/network/index-pack.c b/examples/network/index-pack.c index 69338b37f..4d3dc84d6 100644 --- a/examples/network/index-pack.c +++ b/examples/network/index-pack.c @@ -10,10 +10,10 @@ // This could be run in the main loop whilst the application waits for // the indexing to finish in a worker thread -static int index_cb(const git_indexer_stats *stats, void *data) +static int index_cb(const git_transfer_progress *stats, void *data) { data = data; - printf("\rProcessing %d of %d", stats->processed, stats->total); + printf("\rProcessing %d of %d", stats->indexed_objects, stats->total_objects); return 0; } @@ -21,7 +21,7 @@ static int index_cb(const git_indexer_stats *stats, void *data) int index_pack(git_repository *repo, int argc, char **argv) { git_indexer_stream *idx; - git_indexer_stats stats = {0, 0}; + git_transfer_progress stats = {0, 0}; int error, fd; char hash[GIT_OID_HEXSZ + 1] = {0}; ssize_t read_bytes; @@ -63,7 +63,7 @@ int index_pack(git_repository *repo, int argc, char **argv) if ((error = git_indexer_stream_finalize(idx, &stats)) < 0) goto cleanup; - printf("\rIndexing %d of %d\n", stats.processed, stats.total); + printf("\rIndexing %d of %d\n", stats.indexed_objects, stats.total_objects); git_oid_fmt(hash, git_indexer_stream_hash(idx)); puts(hash);