mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-01 08:49:57 +00:00
Improve clone sample's formatting
This commit is contained in:
parent
9c05c17b7a
commit
2dae54a941
@ -19,17 +19,14 @@ 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 = pd->total_steps > 0
|
||||
? (100.f * pd->completed_steps) / pd->total_steps
|
||||
? (100 * pd->completed_steps) / pd->total_steps
|
||||
: 0.f;
|
||||
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\n",
|
||||
pd->fetch_progress.received, pd->fetch_progress.total,
|
||||
pd->fetch_progress.processed, pd->fetch_progress.total,
|
||||
pd->checkout_progress, pd->path);
|
||||
*/
|
||||
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,
|
||||
checkout_percent, pd->completed_steps, pd->total_steps,
|
||||
pd->path);
|
||||
}
|
||||
|
||||
static void fetch_progress(const git_indexer_stats *stats, void *payload)
|
||||
|
@ -192,7 +192,6 @@ static int checkout_blob(
|
||||
error = blob_content_to_file(
|
||||
blob, git_buf_cstr(data->path), file->mode, data->checkout_opts);
|
||||
|
||||
report_progress(data, file->path);
|
||||
git_blob_free(blob);
|
||||
|
||||
return error;
|
||||
@ -265,11 +264,13 @@ static int checkout_create_the_new(
|
||||
if (!is_submodule && !data->create_submodules) {
|
||||
error = checkout_blob(data, &delta->old_file);
|
||||
data->completed_steps++;
|
||||
report_progress(data, delta->old_file.path);
|
||||
}
|
||||
|
||||
else if (is_submodule && data->create_submodules) {
|
||||
error = checkout_submodule(data, &delta->old_file);
|
||||
data->completed_steps++;
|
||||
report_progress(data, delta->old_file.path);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user