Skip to content

Commit

Permalink
GVFSVerb: check custom Git version bounds
Browse files Browse the repository at this point in the history
We will use the following rules for testing the Git version is
compatible with the current version of VFS for Git:

1. The Platform must match ".vfs."

2. The version must be at least the fixed minimum revision.

3. The Revision must equal the current minimum revision.

This allows us to upgrade Git without updating VFS for Git. Thus, we
could reduce VFS for Git version upgrades when Git releases a security
update.

Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
  • Loading branch information
derrickstolee committed Feb 2, 2021
1 parent 1cb71d0 commit cce6a5f
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions GVFS/GVFS/CommandLine/GVFSVerb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -884,27 +884,23 @@ private void CheckGitVersion(ITracer tracer, GVFSEnlistment enlistment, out stri
this.ReportErrorAndExit(tracer, "Error: Invalid version of git {0}. Must use gvfs version.", version);
}

if (ProcessHelper.IsDevelopmentVersion())
if (gitVersion.IsLessThan(GVFSConstants.SupportedGitVersion))
{
if (gitVersion.IsLessThan(GVFSConstants.SupportedGitVersion))
{
this.ReportErrorAndExit(
tracer,
"Error: Installed git version {0} is less than the supported version of {1}.",
gitVersion,
GVFSConstants.SupportedGitVersion);
}
this.ReportErrorAndExit(
tracer,
"Error: Installed git version {0} is less than the supported version of {1}.",
gitVersion,
GVFSConstants.SupportedGitVersion);
}
else
else if (gitVersion.Revision != GVFSConstants.SupportedGitVersion.Revision)
{
if (!gitVersion.IsEqualTo(GVFSConstants.SupportedGitVersion))
{
this.ReportErrorAndExit(
tracer,
"Error: Installed git version {0} does not match supported version of {1}.",
gitVersion,
GVFSConstants.SupportedGitVersion);
}
this.ReportErrorAndExit(
tracer,
"Error: Installed git version {0} has revision number {1} instead of {2}." +
" This Git version is too new, so either downgrade Git or upgrade VFS for Git",
gitVersion,
gitVersion.Revision,
GVFSConstants.SupportedGitVersion.Revision);
}
}

Expand Down

0 comments on commit cce6a5f

Please sign in to comment.