Skip to content

Commit 7473e58

Browse files
derrickstoleedscho
authored andcommitted
gvfs-helper: show progress of multiple prefetch packs
When using a cache server to download multiple prefetch packs, the GVFS Protocol sends all packs in one download. This download is split into multiple files during that single HTTPS request. This also presents a single progress indicator such as Prefetch 1691384600 (2023-08-07 05:03:20 +0000) (bytes received): 25355702, done. After downloading all of these packs to the `tempPacks` directory of the shared object cache, we run `git index-pack` on each packfile individually. The previous change removed the verbose output of `git index-pack`, but that left the time spend indexing the packs without any progress indicator. Add a new progress indicator that ticks through the different prefetch pack-files that are being installed as we go. This presents a new progress indicator that terminates with output like Installing prefetch packfiles: 100% (14/14), done. This helps users understand what is going on without the extra noise of two output lines per `git index-pack` command. Signed-off-by: Derrick Stolee <derrickstolee@github.com>
1 parent 4268011 commit 7473e58

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

gvfs-helper.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2345,12 +2345,17 @@ static void install_prefetch(struct gh__request_params *params,
23452345
trace2_data_intmax(TR2_CAT, NULL,
23462346
"prefetch/packfile_count", np);
23472347

2348+
if (gh__cmd_opts.show_progress)
2349+
params->progress = start_progress("Installing prefetch packfiles", np);
2350+
23482351
for (k = 0; k < np; k++) {
23492352
extract_packfile_from_multipack(params, status, fd, k);
2353+
display_progress(params->progress, k + 1);
23502354
if (status->ec != GH__ERROR_CODE__OK)
23512355
break;
23522356
nr_installed++;
23532357
}
2358+
stop_progress(&params->progress);
23542359

23552360
if (nr_installed)
23562361
delete_stale_keep_files(params, status);

0 commit comments

Comments
 (0)