Skip to content

Commit 3439a86

Browse files
authored
Merge pull request #1898 from microsoft/milestones/m269
Release M269
2 parents abd6490 + 8da25ce commit 3439a86

7 files changed

Lines changed: 64 additions & 18 deletions

File tree

.github/workflows/build.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,21 +177,21 @@ jobs:
177177
178178
- name: Upload functional tests drop
179179
if: steps.skip.outputs.result != 'true'
180-
uses: actions/upload-artifact@v4
180+
uses: actions/upload-artifact@v6
181181
with:
182182
name: FunctionalTests_${{ matrix.configuration }}
183183
path: artifacts\GVFS.FunctionalTests
184184

185185
- name: Upload FastFetch drop
186186
if: steps.skip.outputs.result != 'true'
187-
uses: actions/upload-artifact@v4
187+
uses: actions/upload-artifact@v6
188188
with:
189189
name: FastFetch_${{ matrix.configuration }}
190190
path: artifacts\FastFetch
191191

192192
- name: Upload installers
193193
if: steps.skip.outputs.result != 'true'
194-
uses: actions/upload-artifact@v4
194+
uses: actions/upload-artifact@v6
195195
with:
196196
name: Installers_${{ matrix.configuration }}
197197
path: artifacts\GVFS.Installers
@@ -220,14 +220,14 @@ jobs:
220220
221221
- name: Download installers
222222
if: steps.skip.outputs.result != 'true'
223-
uses: actions/download-artifact@v5
223+
uses: actions/download-artifact@v7
224224
with:
225225
name: Installers_${{ matrix.configuration }}
226226
path: install
227227

228228
- name: Download functional tests drop
229229
if: steps.skip.outputs.result != 'true'
230-
uses: actions/download-artifact@v5
230+
uses: actions/download-artifact@v7
231231
with:
232232
name: FunctionalTests_${{ matrix.configuration }}
233233
path: ft
@@ -249,7 +249,7 @@ jobs:
249249

250250
- name: Upload installation logs
251251
if: always() && steps.skip.outputs.result != 'true'
252-
uses: actions/upload-artifact@v4
252+
uses: actions/upload-artifact@v6
253253
with:
254254
name: InstallationLogs_${{ matrix.configuration }}_${{ matrix.architecture }}-${{ matrix.nr }}
255255
path: install\logs
@@ -264,14 +264,14 @@ jobs:
264264
265265
- name: Upload functional test results
266266
if: always() && steps.skip.outputs.result != 'true'
267-
uses: actions/upload-artifact@v4
267+
uses: actions/upload-artifact@v6
268268
with:
269269
name: FunctionalTests_Results_${{ matrix.configuration }}_${{ matrix.architecture }}-${{ matrix.nr }}
270270
path: TestResult.xml
271271

272272
- name: Upload Git trace2 output
273273
if: always() && steps.skip.outputs.result != 'true'
274-
uses: actions/upload-artifact@v4
274+
uses: actions/upload-artifact@v6
275275
with:
276276
name: GitTrace2_${{ matrix.configuration }}_${{ matrix.architecture }}-${{ matrix.nr }}
277277
path: C:\temp\git-trace2.log

GVFS/GVFS.Common/Enlistment.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,5 +122,18 @@ public bool GetTrustPackIndexesConfig()
122122

123123
return trustPackIndexes;
124124
}
125+
126+
public bool GetStatusHydrationConfig()
127+
{
128+
var gitProcess = this.CreateGitProcess();
129+
130+
if (gitProcess.TryGetFromConfig(GVFSConstants.GitConfig.ShowHydrationStatus, forceOutsideEnlistment: false, out var valueString)
131+
&& bool.TryParse(valueString, out var statusHydrationConfig))
132+
{
133+
return statusHydrationConfig;
134+
}
135+
136+
return GVFSConstants.GitConfig.ShowHydrationStatusDefault;
137+
}
125138
}
126139
}

GVFS/GVFS.Common/GVFSConstants.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ public static class GitConfig
4242
/* Intended to be a temporary config to allow testing of distrusting pack indexes from cache server
4343
* before it is enabled by default. */
4444
public const string TrustPackIndexes = GVFSPrefix + "trust-pack-indexes";
45+
46+
public const string ShowHydrationStatus = GVFSPrefix + "show-hydration-status";
47+
public const bool ShowHydrationStatusDefault = false;
4548
}
4649

4750
public static class LocalGVFSConfig

GVFS/GVFS.Common/GitStatusCache.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class GitStatusCache : IDisposable
5252

5353
private object cacheFileLock = new object();
5454

55-
internal static bool TEST_EnableHydrationSummary = true;
55+
internal static bool? TEST_EnableHydrationSummaryOverride = null;
5656

5757
public GitStatusCache(GVFSContext context, GitStatusCacheConfig config)
5858
: this(context, config.BackoffTime)
@@ -341,7 +341,8 @@ private void RebuildStatusCacheIfNeeded(bool ignoreBackoff)
341341

342342
private void UpdateHydrationSummary()
343343
{
344-
if (!TEST_EnableHydrationSummary)
344+
bool enabled = TEST_EnableHydrationSummaryOverride ?? this.context.Enlistment.GetStatusHydrationConfig();
345+
if (!enabled)
345346
{
346347
return;
347348
}
@@ -372,9 +373,10 @@ private void UpdateHydrationSummary()
372373
}
373374
else
374375
{
376+
metadata["Exception"] = hydrationSummary.Error?.ToString();
375377
this.context.Tracer.RelatedWarning(
376378
metadata,
377-
$"{nameof(GitStatusCache)}{nameof(RebuildStatusCacheIfNeeded)}: hydration summary could not be calculdated.",
379+
$"{nameof(GitStatusCache)}{nameof(RebuildStatusCacheIfNeeded)}: hydration summary could not be calculated.",
378380
Keywords.Telemetry);
379381
}
380382
}

GVFS/GVFS.Common/HealthCalculator/EnlistmentHydrationSummary.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ public class EnlistmentHydrationSummary
1212
public int TotalFileCount { get; private set; }
1313
public int HydratedFolderCount { get; private set; }
1414
public int TotalFolderCount { get; private set; }
15+
public Exception Error { get; private set; } = null;
16+
1517

1618
public bool IsValid
1719
{
@@ -28,12 +30,12 @@ public string ToMessage()
2830
{
2931
if (!IsValid)
3032
{
31-
return "Error calculating hydration. Run 'gvfs health' for details.";
33+
return "Error calculating hydration summary. Run 'gvfs health' at the repository root for hydration status details.";
3234
}
3335

3436
int fileHydrationPercent = TotalFileCount == 0 ? 0 : (100 * HydratedFileCount) / TotalFileCount;
3537
int folderHydrationPercent = TotalFolderCount == 0 ? 0 : ((100 * HydratedFolderCount) / TotalFolderCount);
36-
return $"{fileHydrationPercent}% of files and {folderHydrationPercent}% of folders hydrated. Run 'gvfs health' for details.";
38+
return $"{fileHydrationPercent}% of files and {folderHydrationPercent}% of folders hydrated. Run 'gvfs health' at the repository root for details.";
3739
}
3840

3941
public static EnlistmentHydrationSummary CreateSummary(
@@ -67,14 +69,15 @@ public static EnlistmentHydrationSummary CreateSummary(
6769
TotalFolderCount = totalFolderCount,
6870
};
6971
}
70-
catch
72+
catch (Exception e)
7173
{
7274
return new EnlistmentHydrationSummary()
7375
{
7476
HydratedFileCount = -1,
7577
HydratedFolderCount = -1,
7678
TotalFileCount = -1,
7779
TotalFolderCount = -1,
80+
Error = e,
7881
};
7982
}
8083
}

GVFS/GVFS.Hooks/Program.cs

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,9 @@ private static void RunPreCommands(string[] args)
8888
ProcessHelper.Run("gvfs", "prefetch --commits", redirectOutput: false);
8989
break;
9090
case "status":
91-
/* If status is being run to serialize for caching, skip the health display */
92-
if (!args.Any(arg => arg.StartsWith("--serialize", StringComparison.OrdinalIgnoreCase)))
91+
/* If status is being run to serialize for caching, or if --porcelain is specified, skip the health display */
92+
if (!ArgsBlockHydrationStatus(args)
93+
&& ConfigurationAllowsHydrationStatus())
9394
{
9495
/* Display a message about the hydration status of the repo */
9596
ProcessHelper.Run("gvfs", "health --status", redirectOutput: false);
@@ -98,6 +99,30 @@ private static void RunPreCommands(string[] args)
9899
}
99100
}
100101

102+
private static bool ArgsBlockHydrationStatus(string[] args)
103+
{
104+
return args.Any(arg =>
105+
arg.StartsWith("--serialize", StringComparison.OrdinalIgnoreCase)
106+
|| arg.StartsWith("--porcelain", StringComparison.OrdinalIgnoreCase));
107+
}
108+
109+
private static bool ConfigurationAllowsHydrationStatus()
110+
{
111+
try
112+
{
113+
ProcessResult result = ProcessHelper.Run("git", $"config --get {GVFSConstants.GitConfig.ShowHydrationStatus}");
114+
bool hydrationStatusEnabled;
115+
if (bool.TryParse(result.Output.Trim(), out hydrationStatusEnabled))
116+
{
117+
return hydrationStatusEnabled;
118+
}
119+
}
120+
catch (Exception)
121+
{
122+
}
123+
return GVFSConstants.GitConfig.ShowHydrationStatusDefault;
124+
}
125+
101126
private static void ExitWithError(params string[] messages)
102127
{
103128
foreach (string message in messages)

GVFS/GVFS.UnitTests/Common/GitStatusCacheTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void SetUp()
7373
this.fileSystem,
7474
new MockGitRepo(tracer, enlistment, this.fileSystem),
7575
enlistment);
76-
GitStatusCache.TEST_EnableHydrationSummary = false;
76+
GitStatusCache.TEST_EnableHydrationSummaryOverride = false;
7777
}
7878

7979
[TearDown]
@@ -85,7 +85,7 @@ public void TearDown()
8585
this.gitParentPath = null;
8686
this.gvfsMetadataPath = null;
8787
this.enlistmentDirectory = null;
88-
GitStatusCache.TEST_EnableHydrationSummary = true;
88+
GitStatusCache.TEST_EnableHydrationSummaryOverride = null;
8989
}
9090

9191
[TestCase]

0 commit comments

Comments
 (0)