summaryrefslogtreecommitdiff
path: root/examples/network/clone.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/clone.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/clone.c')
-rw-r--r--examples/network/clone.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/examples/network/clone.c b/examples/network/clone.c
index a09a94728..54c90aff8 100644
--- a/examples/network/clone.c
+++ b/examples/network/clone.c
@@ -25,13 +25,19 @@ static void print_progress(const progress_data *pd)
: 0.f;
int kbytes = pd->fetch_progress.received_bytes / 1024;
- printf("net %3d%% (%4d kb, %5d/%5d) / idx %3d%% (%5d/%5d) / chk %3d%% (%4" PRIuZ "/%4" PRIuZ ") %s\n",
+ if (pd->fetch_progress.received_objects == pd->fetch_progress.total_objects) {
+ printf("Resolving deltas %d/%d\r",
+ pd->fetch_progress.indexed_deltas,
+ pd->fetch_progress.total_deltas);
+ } else {
+ printf("net %3d%% (%4d kb, %5d/%5d) / idx %3d%% (%5d/%5d) / chk %3d%% (%4" PRIuZ "/%4" PRIuZ ") %s\n",
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 int fetch_progress(const git_transfer_progress *stats, void *payload)