Skip to content

Disable version block when running development version #1834

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion GVFS/GVFS.Common/ProcessHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,16 @@ public static string GetCurrentProcessVersion()

public static bool IsDevelopmentVersion()
{
Version currentVersion = new Version(ProcessHelper.GetCurrentProcessVersion());
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;
}
Expand Down
8 changes: 7 additions & 1 deletion GVFS/GVFS/CommandLine/GVFSVerb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -926,8 +926,14 @@ private bool TryValidateGVFSVersion(GVFSEnlistment enlistment, ITracer tracer, S

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

Version currentVersion = new Version(ProcessHelper.GetCurrentProcessVersion());
IEnumerable<ServerGVFSConfig.VersionRange> allowedGvfsClientVersions =
config != null
? config.AllowedGVFSClientVersions
Expand Down