summaryrefslogtreecommitdiff
path: root/examples/network/fetch.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2013-10-23 15:08:18 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2013-10-23 15:08:18 +0200
commitab46b1d8ebcdc820aefe2c1391d4be73939bce95 (patch)
treef24847504a3aa46be49dbfdab64f6d770914a6d3 /examples/network/fetch.c
parentebbd48f00e87eab699862f03a457571ead3c53b1 (diff)
downloadlibgit2-ab46b1d8ebcdc820aefe2c1391d4be73939bce95.tar.gz
indexer: include the delta stats
The user is unable to derive the number of deltas in the pack, as that would require them to capture the stats exactly in the moment between download and final processing, which is abstracted away in the fetch. Capture these numbers for the user and expose them in the progress struct. The clone and fetch examples now also present this information to the user.
Diffstat (limited to 'examples/network/fetch.c')
-rw-r--r--examples/network/fetch.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/examples/network/fetch.c b/examples/network/fetch.c
index 50ec0033a..b4f6a6ad6 100644
--- a/examples/network/fetch.c
+++ b/examples/network/fetch.c
@@ -72,6 +72,7 @@ int fetch(git_repository *repo, int argc, char **argv)
const git_transfer_progress *stats;
struct dl_data data;
git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT;
+ int resolve_deltas_ln = 0;
#ifndef _WIN32
pthread_t worker;
#endif
@@ -113,10 +114,14 @@ int fetch(git_repository *repo, int argc, char **argv)
do {
usleep(10000);
- if (stats->total_objects > 0)
+ if (stats->received_objects == stats->total_objects) {
+ printf("Resolving deltas %d/%d\r",
+ stats->indexed_deltas, stats->total_deltas);
+ } else if (stats->total_objects > 0) {
printf("Received %d/%d objects (%d) in %" PRIuZ " bytes\r",
stats->received_objects, stats->total_objects,
stats->indexed_objects, stats->received_bytes);
+ }
} while (!data.finished);
if (data.ret < 0)