Skip to content

Commit 6c223d8

Browse files
authored
Merge pull request #1834 from tyrielv/no-validate-development-version
Disable version block when running development version
2 parents 3f8fe0e + 40bfc08 commit 6c223d8

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

GVFS/GVFS.Common/ProcessHelper.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,16 @@ public static string GetCurrentProcessVersion()
5757

5858
public static bool IsDevelopmentVersion()
5959
{
60-
Version currentVersion = new Version(ProcessHelper.GetCurrentProcessVersion());
60+
string version = ProcessHelper.GetCurrentProcessVersion();
61+
/* When debugging local version with VS, the version will include +{commitId} suffix,
62+
* which is not valid for Version class. */
63+
var plusIndex = version.IndexOf('+');
64+
if (plusIndex >= 0)
65+
{
66+
version = version.Substring(0, plusIndex);
67+
}
68+
69+
Version currentVersion = new Version(version);
6170

6271
return currentVersion.Major == 0;
6372
}

GVFS/GVFS/CommandLine/GVFSVerb.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,8 +926,14 @@ private bool TryValidateGVFSVersion(GVFSEnlistment enlistment, ITracer tracer, S
926926

927927
using (ITracer activity = tracer.StartActivity("ValidateGVFSVersion", EventLevel.Informational))
928928
{
929-
Version currentVersion = new Version(ProcessHelper.GetCurrentProcessVersion());
929+
if (ProcessHelper.IsDevelopmentVersion())
930+
{
931+
/* Development Version will start with 0 and include a "+{commitID}" suffix
932+
* so it won't ever be valid, but it needs to be able to run so we can test it. */
933+
return true;
934+
}
930935

936+
Version currentVersion = new Version(ProcessHelper.GetCurrentProcessVersion());
931937
IEnumerable<ServerGVFSConfig.VersionRange> allowedGvfsClientVersions =
932938
config != null
933939
? config.AllowedGVFSClientVersions

0 commit comments

Comments
 (0)