Skip to content
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
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# EditorConfig: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*.cs]
trim_trailing_whitespace = true
1 change: 1 addition & 0 deletions GVFS.sln
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ VisualStudioVersion = 15.0.27428.2015
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DCE11095-DA5F-4878-B58D-2702765560F5}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitattributes = .gitattributes
.gitignore = .gitignore
AuthoringTests.md = AuthoringTests.md
Expand Down
12 changes: 6 additions & 6 deletions GVFS/FastFetch/CheckoutPrefetcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public CheckoutPrefetcher(
int indexThreadCount,
int checkoutThreadCount,
bool allowIndexMetadataUpdateFromWorkingTree,
bool forceCheckout)
bool forceCheckout)
: base(
tracer,
enlistment,
Expand Down Expand Up @@ -142,9 +142,9 @@ public override void Prefetch(string branchOrCommit, bool isBranch)
if (!indexGen.HasFailures)
{
Index newIndex = new Index(
this.Enlistment.EnlistmentRoot,
this.Enlistment.EnlistmentRoot,
this.Tracer,
Path.Combine(this.Enlistment.DotGitRoot, GVFSConstants.DotGit.IndexName),
Path.Combine(this.Enlistment.DotGitRoot, GVFSConstants.DotGit.IndexName),
readOnly: false);

// Update from disk only if the caller says it is ok via command line
Expand All @@ -155,7 +155,7 @@ public override void Prefetch(string branchOrCommit, bool isBranch)
}
}
}

/// <summary>
/// * Updates local branch (N/A for checkout to detached HEAD)
/// * Updates HEAD
Expand All @@ -179,7 +179,7 @@ protected override void UpdateRefs(string branchOrCommit, bool isBranch, GitRefs

base.UpdateRefs(branchOrCommit, isBranch, refs);
}

private Index GetSourceIndex()
{
string indexPath = Path.Combine(this.Enlistment.DotGitRoot, GVFSConstants.DotGit.IndexName);
Expand All @@ -193,7 +193,7 @@ private Index GetSourceIndex()
this.Tracer.RelatedEvent(EventLevel.Informational, "CreateBackup", new EventMetadata() { { "BackupIndexName", backupIndexPath } });
File.Delete(backupIndexPath);
File.Move(indexPath, backupIndexPath);

Index output = new Index(this.Enlistment.EnlistmentRoot, this.Tracer, backupIndexPath, readOnly: true);
output.Parse();
return output;
Expand Down
10 changes: 5 additions & 5 deletions GVFS/FastFetch/CheckoutStage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class CheckoutStage : PrefetchPipelineStage
{
private const string AreaPath = nameof(CheckoutStage);
private const int NumOperationsPerStatus = 10000;

private ITracer tracer;
private Enlistment enlistment;
private string targetCommitSha;
Expand Down Expand Up @@ -54,7 +54,7 @@ public BlockingCollection<string> RequiredBlobs
{
get { return this.diff.RequiredBlobs; }
}

public BlockingCollection<string> AvailableBlobShas { get; }

public bool UpdatedWholeTree
Expand Down Expand Up @@ -124,7 +124,7 @@ protected override void DoWork()

protected override void DoAfterWork()
{
// If for some reason a blob doesn't become available,
// If for some reason a blob doesn't become available,
// checkout might complete with file writes still left undone.
if (this.diff.FileAddOperations.Count > 0)
{
Expand Down Expand Up @@ -162,7 +162,7 @@ private void HandleAllDirectoryOperations()
{
return;
}

switch (treeOp.Operation)
{
case DiffTreeResult.Operations.Modify:
Expand Down Expand Up @@ -259,7 +259,7 @@ private void HandleAllFileAddOperations()
{
return;
}

Interlocked.Increment(ref this.shasReceived);

HashSet<PathWithMode> paths;
Expand Down
18 changes: 9 additions & 9 deletions GVFS/FastFetch/FastFetchVerb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace FastFetch
[Verb("fastfetch", HelpText = "Fast-fetch a branch")]
public class FastFetchVerb
{
// Testing has shown that more than 16 download threads does not improve
// performance even with 56 core machines with 40G NICs. More threads does
// Testing has shown that more than 16 download threads does not improve
// performance even with 56 core machines with 40G NICs. More threads does
// create more load on the servers as they have to handle extra connections.
private const int MaxDefaultDownloadThreads = 16;

Expand Down Expand Up @@ -105,7 +105,7 @@ public class FastFetchVerb
Default = "",
Required = false,
HelpText = "Sets the path and filename for git.exe if it isn't expected to be on %PATH%.")]
public string GitBinPath { get; set; }
public string GitBinPath { get; set; }

[Option(
"folders",
Expand Down Expand Up @@ -171,8 +171,8 @@ private int ExecuteWithExitCode()
{
Console.WriteLine("Cannot use --force-checkout option without --checkout option.");
return ExitFailure;
}

}
this.SearchThreadCount = this.SearchThreadCount > 0 ? this.SearchThreadCount : Environment.ProcessorCount;
this.DownloadThreadCount = this.DownloadThreadCount > 0 ? this.DownloadThreadCount : Math.Min(Environment.ProcessorCount, MaxDefaultDownloadThreads);
this.IndexThreadCount = this.IndexThreadCount > 0 ? this.IndexThreadCount : Environment.ProcessorCount;
Expand All @@ -185,8 +185,8 @@ private int ExecuteWithExitCode()
{
Console.WriteLine("Must be run within a git repo");
return ExitFailure;
}

}
string commitish = this.Commit ?? this.Branch;
if (string.IsNullOrWhiteSpace(commitish))
{
Expand Down Expand Up @@ -238,8 +238,8 @@ private int ExecuteWithExitCode()
tracer.RelatedError(error);
Console.WriteLine(error);
return ExitFailure;
}

}
RetryConfig retryConfig = new RetryConfig(this.MaxAttempts, TimeSpan.FromMinutes(RetryConfig.FetchAndCloneTimeoutMinutes));
BlobPrefetcher prefetcher = this.GetFolderPrefetcher(tracer, enlistment, cacheServer, retryConfig);
if (!BlobPrefetcher.TryLoadFolderList(enlistment, this.FolderList, this.FolderListFile, prefetcher.FolderList, readListFromStdIn: false, error: out error))
Expand Down
2 changes: 1 addition & 1 deletion GVFS/FastFetch/GitEnlistment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public string FastFetchLogRoot
{
get { return Path.Combine(this.EnlistmentRoot, GVFSConstants.DotGit.Root, ".fastfetch"); }
}

public static GitEnlistment CreateFromCurrentDirectory(string gitBinPath)
{
string root = Paths.GetGitEnlistmentRoot(Environment.CurrentDirectory);
Expand Down
18 changes: 9 additions & 9 deletions GVFS/FastFetch/Index.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ public class Index

// Location of the version marker file
private readonly string versionMarkerFile;

private readonly bool readOnly;

// Index paths
private readonly string indexPath;
private readonly string updatedIndexPath;

private readonly ITracer tracer;
private readonly string repoRoot;

Expand Down Expand Up @@ -83,9 +83,9 @@ public Index(
/// 1) If there was an index in place when this object was constructed, then:
/// a) Copy all valid entries (below) from the previous index to the new index
/// b) Conditionally (below) get times/sizes from the working tree for files not updated from the previous index
///
///
/// 2) If there was no index in place, conditionally populate all entries from disk
///
///
/// Conditions:
/// - Working tree is only searched if allowUpdateFromWorkingTree is specified
/// - A valid entry is an entry that exist and has a non-zero creation time (ctime)
Expand All @@ -107,7 +107,7 @@ public void UpdateFileSizesAndTimes(BlockingCollection<string> addedOrEditedLoca
this.Parse();

bool anyEntriesUpdated = false;

using (MemoryMappedFile mmf = this.GetMemoryMappedFile())
using (MemoryMappedViewAccessor indexView = mmf.CreateViewAccessor())
{
Expand Down Expand Up @@ -149,7 +149,7 @@ public void UpdateFileSizesAndTimes(BlockingCollection<string> addedOrEditedLoca
}
}
}

public void Parse()
{
using (ITracer activity = this.tracer.StartActivity("ParseIndex", EventLevel.Informational, Keywords.Telemetry, new EventMetadata() { { "Index", this.updatedIndexPath } }))
Expand Down Expand Up @@ -232,7 +232,7 @@ private bool UpdateFileInformationFromDiskForFiles(MemoryMappedViewAccessor inde
this.tracer.RelatedEvent(EventLevel.Informational, "UpdateIndexFileInformation", new EventMetadata() { { "UpdatedFromDisk", updatedEntriesFromDisk } }, Keywords.Telemetry);
return updatedEntriesFromDisk > 0;
}

private bool UpdateFileInformationForAllEntries(MemoryMappedViewAccessor indexView, Index otherIndex, bool shouldAlsoTryPopulateFromDisk)
{
long updatedEntriesFromOtherIndex = 0;
Expand Down Expand Up @@ -424,7 +424,7 @@ private void ParseIndex(Stream indexStream)
{
// Examine only the things we're not skipping...
// Potential Future Perf Optimization: Perform this work on multiple threads. If we take the first byte and % by number of threads,
// we can ensure that all entries for a given folder end up in the same dictionary
// we can ensure that all entries for a given folder end up in the same dictionary
string path = Encoding.UTF8.GetString(pathBuffer, 0, pathLength);
this.indexEntryOffsets[path] = entryOffset;
}
Expand Down Expand Up @@ -680,7 +680,7 @@ public bool IsExtended
return (this.Flags & Index.ExtendedBit) == Index.ExtendedBit;
}
}

public static bool HasInitializedCTimeEntry(MemoryMappedViewAccessor indexView, long offset)
{
return EndianHelper.Swap(indexView.ReadUInt32(offset + (long)EntryOffsets.ctimeSeconds)) != 0;
Expand Down
2 changes: 1 addition & 1 deletion GVFS/FastFetch/NativeUnixMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace FastFetch
{
public class NativeUnixMethods
public class NativeUnixMethods
{
public const int ReadOnly = 0x0000;
public const int WriteOnly = 0x0001;
Expand Down
6 changes: 3 additions & 3 deletions GVFS/FastFetch/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Reflection;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("FastFetch")]
Expand All @@ -13,8 +13,8 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

Expand Down
3 changes: 1 addition & 2 deletions GVFS/GVFS.Build/GVFS.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<Rule Id="SA1003" Action="None" />
<Rule Id="SA1024" Action="None" />
<Rule Id="SA1025" Action="None" />
<Rule Id="SA1028" Action="None" />
<Rule Id="SA1100" Action="None" />
<Rule Id="SA1107" Action="None" />
<Rule Id="SA1115" Action="None" />
Expand Down Expand Up @@ -65,4 +64,4 @@
<Rule Id="SA1651" Action="None" />
<Rule Id="SA1652" Action="None" />
</Rules>
</RuleSet>
</RuleSet>
2 changes: 1 addition & 1 deletion GVFS/GVFS.Build/GenerateVersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public override bool Execute()
File.WriteAllText(
this.AssemblyVersion,
string.Format(
@"using System.Reflection;
@"using System.Reflection;

[assembly: AssemblyVersion(""{0}"")]
[assembly: AssemblyFileVersion(""{0}"")]
Expand Down
2 changes: 1 addition & 1 deletion GVFS/GVFS.Common/ConcurrentHashSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public ConcurrentHashSet()
{
this.dictionary = new ConcurrentDictionary<T, bool>();
}

public ConcurrentHashSet(IEqualityComparer<T> comparer)
{
this.dictionary = new ConcurrentDictionary<T, bool>(comparer);
Expand Down
20 changes: 10 additions & 10 deletions GVFS/GVFS.Common/ConsoleHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@ public static bool ShowStatusWhileRunning(
};

ActionResult result = ShowStatusWhileRunning(
actionResultAction,
message,
output,
showSpinner,
gvfsLogEnlistmentRoot,
actionResultAction,
message,
output,
showSpinner,
gvfsLogEnlistmentRoot,
initialDelayMs: initialDelayMs);

return result == ActionResult.Success;
}

public static ActionResult ShowStatusWhileRunning(
Func<ActionResult> action,
string message,
TextWriter output,
bool showSpinner,
string gvfsLogEnlistmentRoot,
Func<ActionResult> action,
string message,
TextWriter output,
bool showSpinner,
string gvfsLogEnlistmentRoot,
int initialDelayMs)
{
ActionResult result = ActionResult.Failure;
Expand Down
2 changes: 1 addition & 1 deletion GVFS/GVFS.Common/DiskLayoutUpgrade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static bool TryRunAllUpgrades(string enlistmentRoot)
{
RegisterUpgrade(upgrade);
}

using (JsonTracer tracer = new JsonTracer(GVFSConstants.GVFSEtwProviderName, "DiskLayoutUpgrade"))
{
try
Expand Down
4 changes: 2 additions & 2 deletions GVFS/GVFS.Common/Enlistment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace GVFS.Common
{
public abstract class Enlistment
{
{
protected Enlistment(
string enlistmentRoot,
string workingDirectoryRoot,
Expand Down Expand Up @@ -47,7 +47,7 @@ protected Enlistment(

this.RepoUrl = originUrl.Trim();
}

this.Authentication = authentication ?? new GitAuthentication(gitProcess, this.RepoUrl);
}

Expand Down
Loading