From 73ed7c848f1d3957ef92acea80ed306e6e860c6d Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Tue, 15 Jun 2021 14:02:19 -0400 Subject: [PATCH] fixup! gvfs-helper: add prefetch support Due to how we are calling 'git index-pack' and piping stdout, I found an instance where our 'git index-pack' subcommand is timing out. Since we are using pipe_command() to get the stdout and use that hash to create a new filename, the 'ip.stderr = -1' line breaks the expected behavior, especially when providing '-v'. Let's be more careful about stderr when cloning. The case I saw was for using the prefetch endpoint on Azure Repos on a repo that doesn't have configured cache servers. The pack-file was over 1GB so the progress indicator reliably hit a problem. Signed-off-by: Derrick Stolee --- gvfs-helper.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gvfs-helper.c b/gvfs-helper.c index 568dd1f02043f8..94e05d4942bed0 100644 --- a/gvfs-helper.c +++ b/gvfs-helper.c @@ -1840,13 +1840,19 @@ static void my_run_index_pack(struct gh__request_params *params, strvec_push(&ip.args, "git"); strvec_push(&ip.args, "index-pack"); - if (gh__cmd_opts.show_progress) + + if (gh__cmd_opts.show_progress) { strvec_push(&ip.args, "-v"); + ip.err = 0; + } else { + ip.err = -1; + ip.no_stderr = 1; + } + strvec_pushl(&ip.args, "-o", temp_path_idx->buf, NULL); strvec_push(&ip.args, temp_path_pack->buf); ip.no_stdin = 1; ip.out = -1; - ip.err = -1; if (pipe_command(&ip, NULL, 0, &ip_stdout, 0, NULL, 0)) { unlink(temp_path_pack->buf);