From 96cbde24c66f0f7c90a9b18657aa9ead072cc6a2 Mon Sep 17 00:00:00 2001 From: Tyrie Vella Date: Wed, 24 Sep 2025 09:06:16 -0700 Subject: [PATCH] Handle errors on background prefetch start In some environments "gvfs" may not be properly resolved by the shell when running the background prefetch process, so this change uses the current process path instead. If the background prefetch process fails to start, the error is now displayed to the user with remediation steps and clone continues to the next step. --- GVFS/GVFS/CommandLine/CloneVerb.cs | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/GVFS/GVFS/CommandLine/CloneVerb.cs b/GVFS/GVFS/CommandLine/CloneVerb.cs index e81030837..e1aa098a6 100644 --- a/GVFS/GVFS/CommandLine/CloneVerb.cs +++ b/GVFS/GVFS/CommandLine/CloneVerb.cs @@ -6,9 +6,11 @@ using GVFS.Common.NamedPipes; using GVFS.Common.Tracing; using System; +using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; +using System.Reflection; using System.Text; namespace GVFS.CommandLine @@ -240,15 +242,24 @@ public override void Execute() else { - Process.Start(new ProcessStartInfo( - fileName: "gvfs", - arguments: "prefetch --commits") + try { - UseShellExecute = true, - WindowStyle = ProcessWindowStyle.Hidden, - WorkingDirectory = enlistment.EnlistmentRoot - }); - this.Output.WriteLine("\r\nPrefetch of commit graph has been started as a background process. Git operations involving history may be slower until prefetch has completed.\r\n"); + string gvfsExecutable = Assembly.GetExecutingAssembly().Location; + Process.Start(new ProcessStartInfo( + fileName: gvfsExecutable, + arguments: "prefetch --commits") + { + UseShellExecute = true, + WindowStyle = ProcessWindowStyle.Hidden, + WorkingDirectory = enlistment.EnlistmentRoot + }); + this.Output.WriteLine("\r\nPrefetch of commit graph has been started as a background process. Git operations involving history may be slower until prefetch has completed.\r\n"); + } + catch (Win32Exception ex) + { + this.Output.WriteLine("\r\nError starting prefetch: " + ex.Message); + this.Output.WriteLine("Run 'gvfs prefetch --commits' from within your enlistment to prefetch the commit graph."); + } } }