diff options
author | Ben Straub <bs@github.com> | 2012-10-19 19:23:32 -0700 |
---|---|---|
committer | Ben Straub <bs@github.com> | 2012-10-19 19:36:23 -0700 |
commit | 7bcd9e23e8f64c8622e9213ee0fa3d75d058053b (patch) | |
tree | 42d73408bb7e3df8d487d38ecfaf0efb9c0531c6 /examples/network/clone.c | |
parent | 25e8b20169a6f6919ad49cf32220975ab96b35c8 (diff) | |
download | libgit2-7bcd9e23e8f64c8622e9213ee0fa3d75d058053b.tar.gz |
gitno_buffer: callback on each packet
The fetch code takes advantage of this to implement a
progress callback every 100kb of transfer.
Diffstat (limited to 'examples/network/clone.c')
-rw-r--r-- | examples/network/clone.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/network/clone.c b/examples/network/clone.c index fd30bca5b..5ad9330b9 100644 --- a/examples/network/clone.c +++ b/examples/network/clone.c @@ -18,10 +18,11 @@ 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 checkout_percent = (int)(100.f * pd->checkout_progress); - printf("net %3d%% / idx %3d%% / chk %3d%% %50s\r", - network_percent, index_percent, checkout_percent, pd->path); + int kbytes = pd->fetch_progress.bytes / 1024; + printf("net %3d%% (%6d kb) / idx %3d%% / chk %3d%% %50s\n", + network_percent, kbytes, index_percent, checkout_percent, pd->path); /* - printf("net %5d /%5d – idx %5d /%5d – chk %.04f %20s\r", + printf("net %5d /%5d – idx %5d /%5d – chk %.04f %20s\n", pd->fetch_progress.received, pd->fetch_progress.total, pd->fetch_progress.processed, pd->fetch_progress.total, pd->checkout_progress, pd->path); |