gitno_buffer: callback on each packet

The fetch code takes advantage of this to implement a
progress callback every 100kb of transfer.
This commit is contained in:
Ben Straub
2012-10-19 19:36:23 -07:00
parent 25e8b20169
commit 7bcd9e23e8
6 changed files with 44 additions and 4 deletions
+4 -3
View File
@@ -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);