Skip to content

Commit 4558f66

Browse files
authored
Merge pull request #1385 [Release] Milestone M155
[Release] Milestone M155
2 parents a3e55e2 + 8f26970 commit 4558f66

207 files changed

Lines changed: 5371 additions & 1303 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

GVFS/FastFetch/CheckoutStage.cs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ protected override void DoWork()
9191
Keywords.Telemetry,
9292
metadata: null))
9393
{
94-
Parallel.For(1, this.maxParallel, (i) => { this.HandleAllFileDeleteOperations(); });
94+
Parallel.For(0, this.maxParallel, (i) => { this.HandleAllFileDeleteOperations(); });
9595
EventMetadata metadata = new EventMetadata();
9696
metadata.Add("FilesDeleted", this.fileDeleteCount);
9797
activity.Stop(metadata);
@@ -104,7 +104,7 @@ protected override void DoWork()
104104
Keywords.Telemetry,
105105
metadata: null))
106106
{
107-
Parallel.For(1, this.maxParallel, (i) => { this.HandleAllDirectoryOperations(); });
107+
Parallel.For(0, this.maxParallel, (i) => { this.HandleAllDirectoryOperations(); });
108108
EventMetadata metadata = new EventMetadata();
109109
metadata.Add("DirectoryOperationsCompleted", this.directoryOpCount);
110110
activity.Stop(metadata);
@@ -117,7 +117,7 @@ protected override void DoWork()
117117
Keywords.Telemetry,
118118
metadata: null))
119119
{
120-
Parallel.For(1, this.maxParallel, (i) => { this.HandleAllFileAddOperations(); });
120+
Parallel.For(0, this.maxParallel, (i) => { this.HandleAllFileAddOperations(); });
121121
EventMetadata metadata = new EventMetadata();
122122
metadata.Add("FilesWritten", this.fileWriteCount);
123123
activity.Stop(metadata);
@@ -160,6 +160,8 @@ private void HandleAllDirectoryOperations()
160160
DiffTreeResult treeOp;
161161
while (this.diff.DirectoryOperations.TryDequeue(out treeOp))
162162
{
163+
string absoluteTargetPath = Path.Combine(this.enlistment.WorkingDirectoryBackingRoot, treeOp.TargetPath);
164+
163165
if (this.HasFailures)
164166
{
165167
return;
@@ -171,13 +173,13 @@ private void HandleAllDirectoryOperations()
171173
case DiffTreeResult.Operations.Add:
172174
try
173175
{
174-
Directory.CreateDirectory(treeOp.TargetPath);
176+
Directory.CreateDirectory(absoluteTargetPath);
175177
}
176178
catch (Exception ex)
177179
{
178180
EventMetadata metadata = new EventMetadata();
179181
metadata.Add("Operation", "CreateDirectory");
180-
metadata.Add(nameof(treeOp.TargetPath), treeOp.TargetPath);
182+
metadata.Add(nameof(treeOp.TargetPath), absoluteTargetPath);
181183
this.tracer.RelatedError(metadata, ex.Message);
182184
this.HasFailures = true;
183185
}
@@ -186,27 +188,27 @@ private void HandleAllDirectoryOperations()
186188
case DiffTreeResult.Operations.Delete:
187189
try
188190
{
189-
if (Directory.Exists(treeOp.TargetPath))
191+
if (Directory.Exists(absoluteTargetPath))
190192
{
191-
this.fileSystem.DeleteDirectory(treeOp.TargetPath);
193+
this.fileSystem.DeleteDirectory(absoluteTargetPath);
192194
}
193195
}
194196
catch (Exception ex)
195197
{
196198
// We are deleting directories and subdirectories in parallel
197-
if (Directory.Exists(treeOp.TargetPath))
199+
if (Directory.Exists(absoluteTargetPath))
198200
{
199201
EventMetadata metadata = new EventMetadata();
200202
metadata.Add("Operation", "DeleteDirectory");
201-
metadata.Add(nameof(treeOp.TargetPath), treeOp.TargetPath);
203+
metadata.Add(nameof(treeOp.TargetPath), absoluteTargetPath);
202204
this.tracer.RelatedError(metadata, ex.Message);
203205
this.HasFailures = true;
204206
}
205207
}
206208

207209
break;
208210
default:
209-
this.tracer.RelatedError("Ignoring unexpected Tree Operation {0}: {1}", treeOp.TargetPath, treeOp.Operation);
211+
this.tracer.RelatedError("Ignoring unexpected Tree Operation {0}: {1}", absoluteTargetPath, treeOp.Operation);
210212
continue;
211213
}
212214

GVFS/FastFetch/Index.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ private bool UpdateFileInformationFromDiskForFiles(MemoryMappedViewAccessor inde
213213
addedOrEditedLocalFiles,
214214
(localPath) =>
215215
{
216-
string gitPath = FromDotnetFullPathToGitRelativePath(localPath, this.repoRoot);
216+
string gitPath = localPath.Replace(Path.DirectorySeparatorChar, GVFSConstants.GitPathSeparator);
217217
long offset;
218218
if (this.indexEntryOffsets.TryGetValue(gitPath, out offset))
219219
{

GVFS/GVFS.Build/GVFS.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<PropertyGroup Label="Parameters">
55
<GVFSVersion>0.2.173.2</GVFSVersion>
6-
<GitPackageVersion>2.20190610.5</GitPackageVersion>
6+
<GitPackageVersion>2.20190729.1</GitPackageVersion>
77
</PropertyGroup>
88

99
<PropertyGroup Label="DefaultSettings">

GVFS/GVFS.Common/FileSystem/IPlatformFileSystem.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ public interface IPlatformFileSystem
77
bool SupportsFileMode { get; }
88
void FlushFileBuffers(string path);
99
void MoveAndOverwriteFile(string sourceFileName, string destinationFilename);
10-
void CreateHardLink(string newLinkFileName, string existingFileName);
1110
bool TryGetNormalizedPath(string path, out string normalizedPath, out string errorMessage);
1211
void ChangeMode(string path, ushort mode);
1312
bool HydrateFile(string fileName, byte[] buffer);

GVFS/GVFS.Common/GVFSLock.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,8 @@ public class ActiveGitCommandStats
268268
private long placeholderUpdateFoldersTimeMs;
269269
private long placeholderWriteAndFlushTimeMs;
270270
private int deleteFolderPlacehoderAttempted;
271+
private int folderPlaceholdersDeleted;
272+
private int folderPlaceholdersPathNotFound;
271273
private long parseGitIndexTimeMs;
272274
private long projectionWriteLockHeldMs;
273275

@@ -290,13 +292,22 @@ public void RecordReleaseExternalLockRequested()
290292
this.lockHeldExternallyTimeMs = this.lockAcquiredTime.ElapsedMilliseconds;
291293
}
292294

293-
public void RecordUpdatePlaceholders(long durationMs, long updateFilesMs, long updateFoldersMs, long writeAndFlushMs, int deleteFolderPlacehoderAttempted)
295+
public void RecordUpdatePlaceholders(
296+
long durationMs,
297+
long updateFilesMs,
298+
long updateFoldersMs,
299+
long writeAndFlushMs,
300+
int deleteFolderPlacehoderAttempted,
301+
int folderPlaceholdersDeleted,
302+
int folderPlaceholdersPathNotFound)
294303
{
295304
this.placeholderTotalUpdateTimeMs = durationMs;
296305
this.placeholderUpdateFilesTimeMs = updateFilesMs;
297306
this.placeholderUpdateFoldersTimeMs = updateFoldersMs;
298307
this.placeholderWriteAndFlushTimeMs = writeAndFlushMs;
299308
this.deleteFolderPlacehoderAttempted = deleteFolderPlacehoderAttempted;
309+
this.folderPlaceholdersDeleted = folderPlaceholdersDeleted;
310+
this.folderPlaceholdersPathNotFound = folderPlaceholdersPathNotFound;
300311
}
301312

302313
public void RecordProjectionWriteLockHeld(long durationMs)
@@ -338,6 +349,8 @@ public void AddStatsToTelemetry(EventMetadata metadata)
338349
metadata.Add("UpdateFilePlaceholdersMS", this.placeholderUpdateFilesTimeMs);
339350
metadata.Add("UpdateFolderPlaceholdersMS", this.placeholderUpdateFoldersTimeMs);
340351
metadata.Add("DeleteFolderPlacehoderAttempted", this.deleteFolderPlacehoderAttempted);
352+
metadata.Add("FolderPlaceholdersDeleted", this.folderPlaceholdersDeleted);
353+
metadata.Add("FolderPlaceholdersPathNotFound", this.folderPlaceholdersPathNotFound);
341354
metadata.Add("PlaceholdersWriteAndFlushMS", this.placeholderWriteAndFlushTimeMs);
342355
metadata.Add("ProjectionWriteLockHeldMs", this.projectionWriteLockHeldMs);
343356

GVFS/GVFS.Common/GVFSPlatform.cs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ public GVFSPlatform(UnderConstructionFlags underConstruction)
2727
public UnderConstructionFlags UnderConstruction { get; }
2828
public abstract string Name { get; }
2929

30+
public abstract string GVFSConfigPath { get; }
31+
3032
public static void Register(GVFSPlatform platform)
3133
{
3234
if (GVFSPlatform.Instance != null)
@@ -70,6 +72,27 @@ public static void Register(GVFSPlatform platform)
7072
public abstract bool IsElevated();
7173
public abstract string GetCurrentUser();
7274
public abstract string GetUserIdFromLoginSessionId(int sessionId, ITracer tracer);
75+
76+
/// <summary>
77+
/// Get the directory for upgrades that is permissioned to
78+
/// require elevated privileges to modify. This can be used for
79+
/// data that we don't want normal user accounts to modify.
80+
/// </summary>
81+
public abstract string GetUpgradeProtectedDataDirectory();
82+
83+
/// <summary>
84+
/// Directory that upgrader log directory should be placed
85+
/// in. There can be multiple log directories, so this is the
86+
/// containing directory to place them in.
87+
/// </summary>
88+
public abstract string GetUpgradeLogDirectoryParentDirectory();
89+
90+
/// <summary>
91+
/// Directory that contains the file indicating that a new
92+
/// version is available.
93+
/// </summary>
94+
public abstract string GetUpgradeHighestAvailableVersionDirectory();
95+
7396
public abstract void ConfigureVisualStudio(string gitBinPath, ITracer tracer);
7497

7598
public abstract bool TryGetGVFSHooksPathAndVersion(out string hooksPaths, out string hooksVersion, out string error);
@@ -93,6 +116,10 @@ public abstract FileBasedLock CreateFileBasedLock(
93116
ITracer tracer,
94117
string lockPath);
95118

119+
public abstract ProductUpgraderPlatformStrategy CreateProductUpgraderPlatformInteractions(
120+
PhysicalFileSystem fileSystem,
121+
ITracer tracer);
122+
96123
public bool TryGetNormalizedPathRoot(string path, out string pathRoot, out string errorMessage)
97124
{
98125
pathRoot = null;
@@ -111,8 +138,15 @@ public bool TryGetNormalizedPathRoot(string path, out string pathRoot, out strin
111138
public abstract class GVFSPlatformConstants
112139
{
113140
public static readonly char PathSeparator = Path.DirectorySeparatorChar;
141+
public abstract int MaxPipePathLength { get; }
114142
public abstract string ExecutableExtension { get; }
115143
public abstract string InstallerExtension { get; }
144+
145+
/// <summary>
146+
/// Indicates whether the platform supports running the upgrade application while
147+
/// the upgrade verb is running.
148+
/// </summary>
149+
public abstract bool SupportsUpgradeWhileRunning { get; }
116150
public abstract string WorkingDirectoryBackingRootPath { get; }
117151
public abstract string DotGVFSRoot { get; }
118152

@@ -122,6 +156,20 @@ public abstract class GVFSPlatformConstants
122156

123157
public abstract string GVFSExecutableName { get; }
124158

159+
public abstract string ProgramLocaterCommand { get; }
160+
161+
/// <summary>
162+
/// Different platforms can have different requirements
163+
/// around which processes can block upgrade. For example,
164+
/// on Windows, we will block upgrade if any GVFS commands
165+
/// are running, but on POSIX platforms, we relax this
166+
/// constraint to allow upgrade to run while the upgrade
167+
/// command is running. Another example is that
168+
/// Non-windows platforms do not block upgrade when bash
169+
/// is running.
170+
/// </summary>
171+
public abstract HashSet<string> UpgradeBlockingProcesses { get; }
172+
125173
public string GVFSHooksExecutableName
126174
{
127175
get { return "GVFS.Hooks" + this.ExecutableExtension; }

GVFS/GVFS.Common/Git/DiffTreeResult.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public enum Operations
3838
public ushort SourceMode { get; set; }
3939
public ushort TargetMode { get; set; }
4040

41-
public static DiffTreeResult ParseFromDiffTreeLine(string line, string repoRoot)
41+
public static DiffTreeResult ParseFromDiffTreeLine(string line)
4242
{
4343
if (string.IsNullOrEmpty(line))
4444
{
@@ -100,7 +100,7 @@ public static DiffTreeResult ParseFromDiffTreeLine(string line, string repoRoot)
100100
result.SourceSha = parts[2];
101101
result.TargetSha = parts[3];
102102
result.Operation = DiffTreeResult.ParseOperation(parts[4]);
103-
result.TargetPath = ConvertPathToAbsoluteUtf8Path(repoRoot, parts[5]);
103+
result.TargetPath = ConvertPathToUtf8Path(parts[5]);
104104
if (result.TargetIsDirectory || result.SourceIsDirectory)
105105
{
106106
// Since diff-tree is not doing rename detection, file->directory or directory->file transformations are always multiple lines
@@ -118,7 +118,6 @@ public static DiffTreeResult ParseFromDiffTreeLine(string line, string repoRoot)
118118
/// Parse the output of calling git ls-tree
119119
/// </summary>
120120
/// <param name="line">A line that was output from calling git ls-tree</param>
121-
/// <param name="repoRoot">The root path of the repo that the git ls-tree was ran against</param>
122121
/// <returns>A DiffTreeResult build from the output line</returns>
123122
/// <remarks>
124123
/// The call to ls-tree could be any of the following
@@ -127,7 +126,7 @@ public static DiffTreeResult ParseFromDiffTreeLine(string line, string repoRoot)
127126
/// git ls-tree -t (treeish)
128127
/// git ls-tree -r -t (treeish)
129128
/// </remarks>
130-
public static DiffTreeResult ParseFromLsTreeLine(string line, string repoRoot)
129+
public static DiffTreeResult ParseFromLsTreeLine(string line)
131130
{
132131
if (string.IsNullOrEmpty(line))
133132
{
@@ -149,7 +148,7 @@ public static DiffTreeResult ParseFromLsTreeLine(string line, string repoRoot)
149148
{
150149
DiffTreeResult treeAdd = new DiffTreeResult();
151150
treeAdd.TargetIsDirectory = true;
152-
treeAdd.TargetPath = AppendPathSeparatorIfNeeded(ConvertPathToAbsoluteUtf8Path(repoRoot, line.Substring(line.LastIndexOf("\t") + 1)));
151+
treeAdd.TargetPath = AppendPathSeparatorIfNeeded(ConvertPathToUtf8Path(line.Substring(line.LastIndexOf("\t") + 1)));
153152
treeAdd.Operation = DiffTreeResult.Operations.Add;
154153

155154
return treeAdd;
@@ -162,7 +161,7 @@ public static DiffTreeResult ParseFromLsTreeLine(string line, string repoRoot)
162161
blobAdd.TargetMode = Convert.ToUInt16(line.Substring(0, 6), 8);
163162
blobAdd.TargetIsSymLink = blobAdd.TargetMode == SymLinkFileIndexEntry;
164163
blobAdd.TargetSha = line.Substring(TypeMarkerStartIndex + BlobMarker.Length, GVFSConstants.ShaStringLength);
165-
blobAdd.TargetPath = ConvertPathToAbsoluteUtf8Path(repoRoot, line.Substring(line.LastIndexOf("\t") + 1));
164+
blobAdd.TargetPath = ConvertPathToUtf8Path(line.Substring(line.LastIndexOf("\t") + 1));
166165
blobAdd.Operation = DiffTreeResult.Operations.Add;
167166

168167
return blobAdd;
@@ -213,9 +212,9 @@ private static Operations ParseOperation(string gitOperationString)
213212
}
214213
}
215214

216-
private static string ConvertPathToAbsoluteUtf8Path(string repoRoot, string relativePath)
215+
private static string ConvertPathToUtf8Path(string relativePath)
217216
{
218-
return Path.Combine(repoRoot, GitPathConverter.ConvertPathOctetsToUtf8(relativePath.Trim('"')).Replace(GVFSConstants.GitPathSeparator, Path.DirectorySeparatorChar));
217+
return GitPathConverter.ConvertPathOctetsToUtf8(relativePath.Trim('"')).Replace(GVFSConstants.GitPathSeparator, Path.DirectorySeparatorChar);
219218
}
220219
}
221-
}
220+
}

0 commit comments

Comments
 (0)