From fcee3edbd71c33ff0ee6d18c491875aaceacbfb4 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 18 Sep 2025 13:56:44 +0200 Subject: [PATCH 1/2] IsDevelopmentVersion(): tighten the check It is not _any_ version that starts with `0.` that is a development version, instead it is the version hard-coded in `Version.props` when no `GVFSVersion` has been specified. Signed-off-by: Johannes Schindelin --- GVFS/GVFS.Common/ProcessHelper.cs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/GVFS/GVFS.Common/ProcessHelper.cs b/GVFS/GVFS.Common/ProcessHelper.cs index ad24a6434..4fa57fbaf 100644 --- a/GVFS/GVFS.Common/ProcessHelper.cs +++ b/GVFS/GVFS.Common/ProcessHelper.cs @@ -58,17 +58,7 @@ public static string GetCurrentProcessVersion() public static bool IsDevelopmentVersion() { string version = ProcessHelper.GetCurrentProcessVersion(); - /* When debugging local version with VS, the version will include +{commitId} suffix, - * which is not valid for Version class. */ - var plusIndex = version.IndexOf('+'); - if (plusIndex >= 0) - { - version = version.Substring(0, plusIndex); - } - - Version currentVersion = new Version(version); - - return currentVersion.Major == 0; + return version.Equals("0.2.173.2") || version.StartsWith("0.2.173.2+"); } public static string GetProgramLocation(string programLocaterCommand, string processName) From 436bab46b91fa1836f339f2989df1547f621e3f5 Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Thu, 18 Sep 2025 13:59:45 +0200 Subject: [PATCH 2/2] TryValidateGVFSVersion: allow for the version to include a commit ID In .NET SDK 8, the Informational Version attribute of the assembly includes the commit ID of the current HEAD at build time: https://learn.microsoft.com/en-us/dotnet/core/compatibility/sdk/8.0/source-link This kind of version might be compliant with SemVer v2.0, but it is _not_ System.Version-compliant. Therefore, we opted out of this new behavior _really quickly_ after upgrading from SDK 3 to SDK 9, in order to fix cloning from repositories where `gvfs/config` requires certain minimal VFSforGit versions. In this here commit, we adapt the logic to strip off the commit ID if present. That way, the version check would continue to work even if we opted back in to this new behavior that includes the commit SHA in `gvfs version`'s output. Signed-off-by: Johannes Schindelin --- GVFS/GVFS/CommandLine/GVFSVerb.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/GVFS/GVFS/CommandLine/GVFSVerb.cs b/GVFS/GVFS/CommandLine/GVFSVerb.cs index a9fcb9587..fa183c7a3 100644 --- a/GVFS/GVFS/CommandLine/GVFSVerb.cs +++ b/GVFS/GVFS/CommandLine/GVFSVerb.cs @@ -933,7 +933,11 @@ private bool TryValidateGVFSVersion(GVFSEnlistment enlistment, ITracer tracer, S return true; } - Version currentVersion = new Version(ProcessHelper.GetCurrentProcessVersion()); + string recordedVersion = ProcessHelper.GetCurrentProcessVersion(); + // Work around the default behavior in .NET SDK 8 where the revision ID + // is appended after a '+' character, which cannot be parsed by `System.Version`. + int plus = recordedVersion.IndexOf('+'); + Version currentVersion = new Version(plus < 0 ? recordedVersion : recordedVersion.Substring(0, plus)); IEnumerable allowedGvfsClientVersions = config != null ? config.AllowedGVFSClientVersions