Skip to content

Commit 80f5df6

Browse files
committed
PR feedback
1 parent fa32180 commit 80f5df6

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

GVFS/GVFS.Common/Git/LibGit2RepoInvoker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public void InitializeSharedRepo()
8787
this.GetSharedRepo()?.ObjectExists("30380be3963a75e4a34e10726795d644659e1129");
8888
}
8989

90-
public bool GetConfigBoolWithFallback(string key, bool defaultValue)
90+
public bool GetConfigBoolOrDefault(string key, bool defaultValue)
9191
{
9292
bool? value = defaultValue;
9393
if (this.TryInvoke(repo => repo.GetConfigBool(key), out value))

GVFS/GVFS.Common/GitStatusCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ private void RebuildStatusCacheIfNeeded(bool ignoreBackoff)
342342
private void UpdateHydrationSummary()
343343
{
344344
bool enabled = TEST_EnableHydrationSummaryOverride
345-
?? this.context.Repository.LibGit2RepoInvoker.GetConfigBoolWithFallback(GVFSConstants.GitConfig.ShowHydrationStatus, GVFSConstants.GitConfig.ShowHydrationStatusDefault);
345+
?? this.context.Repository.LibGit2RepoInvoker.GetConfigBoolOrDefault(GVFSConstants.GitConfig.ShowHydrationStatus, GVFSConstants.GitConfig.ShowHydrationStatusDefault);
346346
if (!enabled)
347347
{
348348
return;

GVFS/GVFS.Common/Maintenance/PrefetchStep.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public bool TryPrefetchCommitsAndTrees(out string error, GitProcess gitProcess =
5656
return false;
5757
}
5858

59-
var trustPackIndexes = this.Context.Repository.LibGit2RepoInvoker.GetConfigBoolWithFallback(GVFSConstants.GitConfig.TrustPackIndexes, GVFSConstants.GitConfig.TrustPackIndexesDefault);
59+
var trustPackIndexes = this.Context.Repository.LibGit2RepoInvoker.GetConfigBoolOrDefault(GVFSConstants.GitConfig.TrustPackIndexes, GVFSConstants.GitConfig.TrustPackIndexesDefault);
6060

6161
if (!this.GitObjects.TryDownloadPrefetchPacks(gitProcess, maxGoodTimeStamp, trustPackIndexes, out packIndexes))
6262
{

GVFS/GVFS.Hooks/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ private static bool ConfigurationAllowsHydrationStatus()
112112
{
113113
using (LibGit2RepoInvoker repo = new LibGit2RepoInvoker(NullTracer.Instance, normalizedCurrentDirectory))
114114
{
115-
return repo.GetConfigBoolWithFallback(GVFSConstants.GitConfig.ShowHydrationStatus, GVFSConstants.GitConfig.ShowHydrationStatusDefault);
115+
return repo.GetConfigBoolOrDefault(GVFSConstants.GitConfig.ShowHydrationStatus, GVFSConstants.GitConfig.ShowHydrationStatusDefault);
116116
}
117117
}
118118

GVFS/GVFS/CommandLine/CloneVerb.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ public override void Execute()
121121

122122
CacheServerInfo cacheServer = null;
123123
ServerGVFSConfig serverGVFSConfig = null;
124+
bool trustPackIndexes;
124125

125126
using (JsonTracer tracer = new JsonTracer(GVFSConstants.GVFSEtwProviderName, "GVFSClone"))
126127
{
@@ -216,18 +217,17 @@ public override void Execute()
216217
{
217218
tracer.RelatedError(cloneResult.ErrorMessage);
218219
}
220+
221+
using (var repo = new LibGit2RepoInvoker(tracer, enlistment.WorkingDirectoryBackingRoot))
222+
{
223+
trustPackIndexes = repo.GetConfigBoolOrDefault(GVFSConstants.GitConfig.TrustPackIndexes, GVFSConstants.GitConfig.TrustPackIndexesDefault);
224+
}
219225
}
220226

221227
if (cloneResult.Success)
222228
{
223229
if (!this.NoPrefetch)
224230
{
225-
bool trustPackIndexes;
226-
using (var repo = new LibGit2RepoInvoker(NullTracer.Instance, enlistment.WorkingDirectoryBackingRoot))
227-
{
228-
trustPackIndexes = repo.GetConfigBoolWithFallback(GVFSConstants.GitConfig.TrustPackIndexes, GVFSConstants.GitConfig.TrustPackIndexesDefault);
229-
}
230-
231231
/* If pack indexes are not trusted, the prefetch can take a long time.
232232
* We will run the prefetch command in the background.
233233
*/

0 commit comments

Comments
 (0)