public static bool TryLoadFromGitConfig(ITracer tracer, GitProcess git, out GitStatusCacheConfig gitStatusCacheConfig, out string error) { gitStatusCacheConfig = DefaultConfig; int backOffTimeSeconds = (int)DefaultBackoffTime.TotalSeconds; if (!TryLoadBackOffTime(git, out backOffTimeSeconds, out error)) { if (tracer != null) { tracer.RelatedError( new EventMetadata { { "Area", EtwArea }, { "error", error } }, $"{nameof(GitStatusCacheConfig.TryLoadFromGitConfig)}: TryLoadBackOffTime failed"); } return(false); } gitStatusCacheConfig = new GitStatusCacheConfig(TimeSpan.FromSeconds(backOffTimeSeconds)); if (tracer != null) { tracer.RelatedEvent( EventLevel.Informational, "GitStatusCacheConfig_Loaded", new EventMetadata { { "Area", EtwArea }, { "BackOffTime", gitStatusCacheConfig.BackoffTime }, { TracingConstants.MessageKey.InfoMessage, "GitStatusCacheConfigLoaded" } }); } return(true); }
public GitStatusCache(GSDContext context, GitStatusCacheConfig config) : this(context, config.BackoffTime) { }
public static bool TryLoadFromGitConfig(ITracer tracer, Enlistment enlistment, out GitStatusCacheConfig gitStatusCacheConfig, out string error) { return(TryLoadFromGitConfig(tracer, new GitProcess(enlistment), out gitStatusCacheConfig, out error)); }