Skip to content

Commit

Permalink
Merge pull request #89: UntrackedCache: enable based on platform
Browse files Browse the repository at this point in the history
While adding functional tests in #77, I noticed that functional tests on Windows were failing due to the untracked cache. I was unable to repro them when paused in the debugger, so it must be something wrong with however Git detects changes to the filesystem using timestamps.

For now, re-enable the untracked cache on non-Windows platforms. Since it is related to the filesystem, I put the constant there.
  • Loading branch information
derrickstolee authored Aug 27, 2019
2 parents 38070a1 + f2e2236 commit 1dabdcc
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions Scalar.Common/FileSystem/IPlatformFileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace Scalar.Common.FileSystem
public interface IPlatformFileSystem
{
bool SupportsFileMode { get; }
bool SupportsUntrackedCache { get; }
void FlushFileBuffers(string path);
void MoveAndOverwriteFile(string sourceFileName, string destinationFilename);
bool TryGetNormalizedPath(string path, out string normalizedPath, out string errorMessage);
Expand Down
2 changes: 2 additions & 0 deletions Scalar.Platform.POSIX/POSIXFileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public enum OpenFlags

public bool SupportsFileMode { get; } = true;

public bool SupportsUntrackedCache { get; } = true;

public void FlushFileBuffers(string path)
{
// TODO(#1057): Use native API to flush file
Expand Down
2 changes: 2 additions & 0 deletions Scalar.Platform.Windows/WindowsFileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public partial class WindowsFileSystem : IPlatformFileSystem
{
public bool SupportsFileMode { get; } = false;

public bool SupportsUntrackedCache { get; } = false;

/// <summary>
/// Adds a new FileSystemAccessRule granting read (and optionally modify) access for all users.
/// </summary>
Expand Down
2 changes: 2 additions & 0 deletions Scalar.UnitTests/Mock/FileSystem/MockPlatformFileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ public class MockPlatformFileSystem : IPlatformFileSystem
{
public bool SupportsFileMode { get; } = true;

public bool SupportsUntrackedCache { get; } = true;

public void FlushFileBuffers(string path)
{
throw new NotSupportedException();
Expand Down
2 changes: 1 addition & 1 deletion Scalar/CommandLine/ScalarVerb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public static bool TrySetRequiredGitConfigSettings(Enlistment enlistment)
{ "core.multiPackIndex", "true" },
{ "core.preloadIndex", "true" },
{ "core.safecrlf", "false" },
{ "core.untrackedCache", "false" },
{ "core.untrackedCache", ScalarPlatform.Instance.FileSystem.SupportsUntrackedCache ? "true" : "false" },
{ "core.repositoryformatversion", "0" },
{ "core.filemode", ScalarPlatform.Instance.FileSystem.SupportsFileMode ? "true" : "false" },
{ GitConfigSetting.CoreVirtualizeObjectsName, "true" },
Expand Down

0 comments on commit 1dabdcc

Please sign in to comment.