Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@dscho
Copy link
Member

@dscho dscho commented Sep 18, 2025

As reported by @tyrielv, gvfs clone would fail with https://github.com/microsoft/VFSForGit/releases/tag/v1.0.25260.1 when the repository to clone specifies a minimal VFSforGit version in its gvfs/config endpoint. The reason is that with the version bump from .NET SDK v3 to v9, the version string included in the assembly now contains the suffix +<commit-SHA>, which cannot be parsed by System.Version:

Cannot clone @ C:\path: System.FormatException: Input string was not in a correct format.
   at System.Version.VersionResult.SetFailure(ParseFailureKind failure, String argument)
   at System.Version.TryParseComponent(String component, String componentName, VersionResult& result, Int32& parsedComponent)
   at System.Version.TryParseVersion(String version, VersionResult& result)
   at System.Version.Parse(String input)
   at System.Version..ctor(String version)
   at GVFS.CommandLine.GVFSVerb.TryValidateGVFSVersion(GVFSEnlistment enlistment, ITracer tracer, ServerGVFSConfig config, String& errorMessage, Boolean& errorIsFatal)
   at GVFS.CommandLine.GVFSVerb.ValidateClientVersions(ITracer tracer, GVFSEnlistment enlistment, ServerGVFSConfig gvfsConfig, Boolean showWarnings)
   at GVFS.CommandLine.CloneVerb.Execute()

@mjcheetham provided a quick work-around in #1870 to opt out of the new behavior and report the version without that suffix again; Here is a PR that prepares the code to handle such versions gracefully, to open up the door to opt back in to the new behavior (and let gvfs version report an even more informative output than right now).

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 <[email protected]>
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 <[email protected]>
@dscho dscho requested review from mjcheetham and tyrielv September 18, 2025 12:15
@dscho dscho self-assigned this Sep 18, 2025
@dscho dscho enabled auto-merge September 18, 2025 12:51
@dscho dscho merged commit 25e7cd3 into master Sep 18, 2025
53 checks passed
@mjcheetham mjcheetham mentioned this pull request Sep 18, 2025
@dscho dscho deleted the fix-gvfs-clone-version-check-when-revision-is-included branch September 18, 2025 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants