Skip to content

Commit

Permalink
Changes since the last update
Browse files Browse the repository at this point in the history
Update SHA values in functional tests to work against test repo
Install GVFS-Aware Git on MacOS (without standing up PreBuild)
Only start the background prefetch if the operation would use a cache server
Prevent NullReferenceException during enumeration callbacks
Update GVFS VC Runtime platform and remove .NET 3.5 dependency
Fix build error on VS2017 Update 8
Merge features/status_cache to master
  • Loading branch information
Kevin Willford committed Aug 10, 2018
1 parent c7e3741 commit 06793f2
Show file tree
Hide file tree
Showing 73 changed files with 2,130 additions and 496 deletions.
8 changes: 5 additions & 3 deletions GVFS/FastFetch/FastFetch.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\GVFS.Common\GVFS.Common.csproj">
Expand All @@ -86,11 +88,11 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\..\packages\StyleCop.Error.MSBuild.1.0.0\build\StyleCop.Error.MSBuild.Targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\StyleCop.Error.MSBuild.1.0.0\build\StyleCop.Error.MSBuild.Targets'))" />
<Error Condition="!Exists('..\..\..\packages\StyleCop.MSBuild.4.7.54.0\build\StyleCop.MSBuild.Targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\StyleCop.MSBuild.4.7.54.0\build\StyleCop.MSBuild.Targets'))" />
<Error Condition="!Exists('..\LibGit2Sharp.NativeBinaries.props')" Text="$([System.String]::Format('$(ErrorText)', '..\LibGit2Sharp.NativeBinaries.props'))" />
<Error Condition="!Exists('..\..\..\packages\StyleCop.MSBuild.5.0.0\build\StyleCop.MSBuild.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\StyleCop.MSBuild.5.0.0\build\StyleCop.MSBuild.targets'))" />
</Target>
<Import Project="..\..\..\packages\StyleCop.Error.MSBuild.1.0.0\build\StyleCop.Error.MSBuild.Targets" Condition="Exists('..\..\..\packages\StyleCop.Error.MSBuild.1.0.0\build\StyleCop.Error.MSBuild.Targets')" />
<Import Project="..\..\..\packages\StyleCop.MSBuild.4.7.54.0\build\StyleCop.MSBuild.Targets" Condition="Exists('..\..\..\packages\StyleCop.MSBuild.4.7.54.0\build\StyleCop.MSBuild.Targets')" />
<Import Project="..\..\..\packages\StyleCop.MSBuild.5.0.0\build\StyleCop.MSBuild.targets" Condition="Exists('..\..\..\packages\StyleCop.MSBuild.5.0.0\build\StyleCop.MSBuild.targets')" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
2 changes: 1 addition & 1 deletion GVFS/FastFetch/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
<package id="CommandLineParser" version="2.1.1-beta" targetFramework="net461" />
<package id="LibGit2Sharp.NativeBinaries" version="1.0.165" targetFramework="net461" />
<package id="StyleCop.Error.MSBuild" version="1.0.0" targetFramework="net461" />
<package id="StyleCop.MSBuild" version="4.7.54.0" targetFramework="net461" developmentDependency="true" />
<package id="StyleCop.MSBuild" version="5.0.0" targetFramework="net461" developmentDependency="true" />
</packages>
14 changes: 13 additions & 1 deletion GVFS/GVFS.Build/GVFS.PreBuild.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RegisterForComInterop>true</RegisterForComInterop>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<DefineConstants>TRACE</DefineConstants>
Expand Down Expand Up @@ -60,6 +59,19 @@
<Target Name="GetCopyToOutputDirectoryItems" />
<Target Name="Publish" />

<!-- The following targets are defined here so that we can build
this project without emitting an assembly. -->
<Target Name="BuiltProjectOutputGroup" />
<Target Name="BuiltProjectOutputGroupDependencies" />
<Target Name="DebugSymbolsProjectOutputGroup" />
<Target Name="DebugSymbolsProjectOutputGroupDependencies" />
<Target Name="DocumentationProjectOutputGroup" />
<Target Name="DocumentationProjectOutputGroupDependencies" />
<Target Name="SatelliteDllsProjectOutputGroup" />
<Target Name="SatelliteDllsProjectOutputGroupDependencies" />
<Target Name="SGenFilesOutputGroup" />
<Target Name="SGenFilesOutputGroupDependencies" />

<UsingTask TaskName="GenerateG4WNugetReference" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v12.0.dll">
<ParameterGroup>
<GitPackageVersion ParameterType="System.String" Required="true" />
Expand Down
13 changes: 13 additions & 0 deletions GVFS/GVFS.Common/GVFSConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public static class GitConfig
public const string GVFSPrefix = "gvfs.";
public const string MaxRetriesConfig = GVFSPrefix + "max-retries";
public const string TimeoutSecondsConfig = GVFSPrefix + "timeout-seconds";
public const string GitStatusCacheBackoffConfig = GVFSPrefix + "status-cache-backoff-seconds";
public const string MountId = GVFSPrefix + "mount-id";
public const string EnlistmentId = GVFSPrefix + "enlistment-id";
public const string CacheServer = GVFSPrefix + "cache-server";
Expand All @@ -34,6 +35,11 @@ public static class GitConfig
public const string HooksExtension = ".hooks";
}

public static class GitStatusCache
{
public const string EnableGitStatusCacheTokenFile = "EnableGitStatusCacheToken.dat";
}

public static class Service
{
public const string ServiceName = "GVFS.Service";
Expand Down Expand Up @@ -94,6 +100,12 @@ public static class Databases
public static readonly string ModifiedPaths = Path.Combine(Name, "ModifiedPaths.dat");
public static readonly string RepoMetadata = Path.Combine(Name, "RepoMetadata.dat");
}

public static class GitStatusCache
{
public const string Name = "gitStatusCache";
public static readonly string CachePath = Path.Combine(Name, "GitStatusCache.dat");
}
}

public static class DotGit
Expand Down Expand Up @@ -175,6 +187,7 @@ public static class Refs
public static class Heads
{
public static readonly string Root = Path.Combine(DotGit.Refs.Root, "heads");
public static readonly string RootFolder = Heads.Root + Path.DirectorySeparatorChar;
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion GVFS/GVFS.Common/GVFSEnlistment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public GVFSEnlistment(string enlistmentRoot, string repoUrl, string gitBinPath,
{
this.NamedPipeName = GVFSPlatform.Instance.GetNamedPipeName(this.EnlistmentRoot);
this.DotGVFSRoot = Path.Combine(this.EnlistmentRoot, GVFSConstants.DotGVFS.Root);
this.GitStatusCacheFolder = Path.Combine(this.DotGVFSRoot, GVFSConstants.DotGVFS.GitStatusCache.Name);
this.GitStatusCachePath = Path.Combine(this.DotGVFSRoot, GVFSConstants.DotGVFS.GitStatusCache.CachePath);
this.GVFSLogsRoot = Path.Combine(this.EnlistmentRoot, GVFSConstants.DotGVFS.LogPath);
this.LocalObjectsRoot = Path.Combine(this.WorkingDirectoryRoot, GVFSConstants.DotGit.Objects.Root);
}
Expand Down Expand Up @@ -58,6 +60,8 @@ private GVFSEnlistment(string enlistmentRoot, string gitBinPath, string gvfsHook
public override string GitObjectsRoot { get; protected set; }
public override string LocalObjectsRoot { get; protected set; }
public override string GitPackRoot { get; protected set; }
public string GitStatusCacheFolder { get; private set; }
public string GitStatusCachePath { get; private set; }

// These version properties are only used in logging during clone and mount to track version numbers
public string GitVersion
Expand All @@ -74,7 +78,7 @@ public string GVFSHooksVersion
{
get { return this.gvfsHooksVersion; }
}

public static GVFSEnlistment CreateWithoutRepoUrlFromDirectory(string directory, string gitBinRoot, string gvfsHooksRoot)
{
if (Directory.Exists(directory))
Expand Down
2 changes: 2 additions & 0 deletions GVFS/GVFS.Common/GVFSPlatform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ public static void Register(GVFSPlatform platform)
public abstract bool IsConsoleOutputRedirectedToFile();
public abstract bool TryGetGVFSEnlistmentRoot(string directory, out string enlistmentRoot, out string errorMessage);

public abstract bool IsGitStatusCacheSupported();

public bool TryGetNormalizedPathRoot(string path, out string pathRoot, out string errorMessage)
{
pathRoot = null;
Expand Down
5 changes: 5 additions & 0 deletions GVFS/GVFS.Common/Git/GitObjects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,11 @@ public virtual string[] ReadPackFileNames(string packFolderPath, string prefixFi
return new string[0];
}

public virtual bool IsUsingCacheServer()
{
return !this.GitObjectRequestor.CacheServer.IsNone(this.Enlistment.RepoUrl);
}

private static string GetRandomPackName(string packRoot)
{
string packName = "pack-" + Guid.NewGuid().ToString("N") + ".pack";
Expand Down
15 changes: 13 additions & 2 deletions GVFS/GVFS.Common/Git/GitProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,20 @@ public Result ForceCheckout(string target)
return this.InvokeGitInWorkingDirectoryRoot("checkout -f " + target, useReadObjectHook: false);
}

public Result Status(bool allowObjectDownloads)
public Result Status(bool allowObjectDownloads, bool useStatusCache)
{
return this.InvokeGitInWorkingDirectoryRoot("status", useReadObjectHook: allowObjectDownloads);
string command = useStatusCache ? "status" : "status --no-deserialize";
return this.InvokeGitInWorkingDirectoryRoot(command, useReadObjectHook: allowObjectDownloads);
}

public Result SerializeStatus(bool allowObjectDownloads, string serializePath)
{
// specify ignored=matching and --untracked-files=complete
// so the status cache can answer status commands run by Visual Studio
// or tools with similar requirements.
return this.InvokeGitInWorkingDirectoryRoot(
string.Format("--no-optional-locks status \"--serialize={0}\" --ignored=matching --untracked-files=complete", serializePath),
useReadObjectHook: allowObjectDownloads);
}

public Result UnpackObjects(Stream packFileStream)
Expand Down
11 changes: 11 additions & 0 deletions GVFS/GVFS.Common/GitCommandLineParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ public bool IsResetSoftOrMixed()
!this.HasArgument("--merge");
}

public bool IsSerializedStatus()
{
return this.IsVerb(Verbs.Status) &&
this.HasArgumentPrefix("--serialize");
}

/// <summary>
/// This method currently just makes a best effort to detect file paths. Only use this method for optional optimizations
/// related to file paths. Do NOT use this method if you require a reliable answer.
Expand Down Expand Up @@ -126,6 +132,11 @@ private bool HasArgument(string argument)
return this.HasAnyArgument(arg => arg == argument);
}

private bool HasArgumentPrefix(string argument)
{
return this.HasAnyArgument(arg => arg.StartsWith(argument, StringComparison.Ordinal));
}

private bool HasArgumentAtIndex(string argument, int argumentIndex)
{
int actualIndex = argumentIndex + ArgumentsOffset;
Expand Down
Loading

0 comments on commit 06793f2

Please sign in to comment.