private static string GetConfigValue(string gitBinRoot, string configKey) { string value = string.Empty; string error; GitProcess.ConfigResult result = GitProcess.GetFromSystemConfig(gitBinRoot, configKey); if (!result.TryParseAsString(out value, out error, defaultValue: string.Empty) || string.IsNullOrWhiteSpace(value)) { result = GitProcess.GetFromGlobalConfig(gitBinRoot, configKey); result.TryParseAsString(out value, out error, defaultValue: string.Empty); } return(value.TrimEnd('\r', '\n')); }
private static string GetConfigValue(string gitBinRoot, string configKey) { GitProcess.Result result = GitProcess.GetFromSystemConfig(gitBinRoot, configKey); if (result.HasErrors || string.IsNullOrEmpty(result.Output.TrimEnd('\r', '\n'))) { result = GitProcess.GetFromGlobalConfig(gitBinRoot, configKey); } if (result.HasErrors || string.IsNullOrEmpty(result.Output.TrimEnd('\r', '\n'))) { return(string.Empty); } return(result.Output.TrimEnd('\r', '\n')); }
public static ETWTelemetryEventListener CreateTelemetryListenerIfEnabled(string gitBinRoot, string providerName) { // This listener is disabled unless the user specifies the proper git config setting. GitProcess.Result result = GitProcess.GetFromSystemConfig(gitBinRoot, GVFSConstants.GitConfig.GVFSTelemetryId); if (result.HasErrors || string.IsNullOrEmpty(result.Output.TrimEnd('\r', '\n'))) { result = GitProcess.GetFromGlobalConfig(gitBinRoot, GVFSConstants.GitConfig.GVFSTelemetryId); } if (!result.HasErrors && !string.IsNullOrEmpty(result.Output.TrimEnd('\r', '\n'))) { string[] traitsList = result.Output.TrimEnd('\r', '\n').Split('|'); return(new ETWTelemetryEventListener(providerName, traitsList)); } else { return(null); } }