Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 1 addition & 112 deletions src/CredentialManager/CredentialManager.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using GitCredentialManager.Interop.Windows;
using System.Collections.Generic;

namespace GitCredentialManager;

Expand Down Expand Up @@ -42,113 +40,4 @@ class CredentialManagerStore(ICredentialStore store, ICommandContext context) :
public IList<string> GetAccounts(string service) => store.GetAccounts(service);
public bool Remove(string service, string account) => store.Remove(service, account);
}

class CommandContextWrapper(CommandContext context, string? @namespace) : ICommandContext
{
readonly ISettings settings = new SettingsWrapper(
context.Settings is WindowsSettings ?
new NoGitWindowsSettings(context.Environment, context.Git, context.Trace) :
new NoGitSettings(context.Environment, context.Git), @namespace);

public ISettings Settings => settings;

#region pass-through impl.

public string ApplicationPath { get => ((ICommandContext)context).ApplicationPath; set => ((ICommandContext)context).ApplicationPath = value; }

public string InstallationDirectory => ((ICommandContext)context).InstallationDirectory;

public IStandardStreams Streams => ((ICommandContext)context).Streams;

public ITerminal Terminal => ((ICommandContext)context).Terminal;

public ISessionManager SessionManager => ((ICommandContext)context).SessionManager;

public ITrace Trace => ((ICommandContext)context).Trace;

public ITrace2 Trace2 => ((ICommandContext)context).Trace2;

public IFileSystem FileSystem => ((ICommandContext)context).FileSystem;

public ICredentialStore CredentialStore => ((ICommandContext)context).CredentialStore;

public IHttpClientFactory HttpClientFactory => ((ICommandContext)context).HttpClientFactory;

public IGit Git => new NoGit(context.Git);

public IEnvironment Environment => ((ICommandContext)context).Environment;

public IProcessManager ProcessManager => ((ICommandContext)context).ProcessManager;

public void Dispose() => ((IDisposable)context).Dispose();

#endregion
}

class NoGitSettings(IEnvironment environment, IGit git) : Settings(environment, new NoGit(git)) { }

class NoGitWindowsSettings(IEnvironment environment, IGit git, ITrace trace) : WindowsSettings(environment, new NoGit(git), trace) { }

class SettingsWrapper(ISettings settings, string? @namespace) : ISettings
{
public string CredentialNamespace => @namespace ?? settings.CredentialNamespace;

#region pass-through impl.

public string CredentialBackingStore => settings.CredentialBackingStore;

public bool UseMsAuthDefaultAccount => settings.UseMsAuthDefaultAccount;

public IEnumerable<string> GetSettingValues(string envarName, string section, string property, bool isPath)
=> settings.GetSettingValues(envarName, section, property, isPath);

public bool GetTracingEnabled(out string value) => settings.GetTracingEnabled(out value);
public bool TryGetPathSetting(string envarName, string section, string property, out string value) => settings.TryGetPathSetting(envarName, section, property, out value);
public bool TryGetSetting(string envarName, string section, string property, out string value) => settings.TryGetSetting(envarName, section, property, out value);

public Uri RemoteUri { get => settings.RemoteUri; set => settings.RemoteUri = value; }

public bool IsDebuggingEnabled => settings.IsDebuggingEnabled;

public bool IsTerminalPromptsEnabled => settings.IsTerminalPromptsEnabled;

public bool IsGuiPromptsEnabled { get => settings.IsGuiPromptsEnabled; set => settings.IsGuiPromptsEnabled = value; }

public bool IsInteractionAllowed => settings.IsInteractionAllowed;

public bool IsSecretTracingEnabled => settings.IsSecretTracingEnabled;

public bool IsMsalTracingEnabled => settings.IsMsalTracingEnabled;

public string ProviderOverride => settings.ProviderOverride;

public string LegacyAuthorityOverride => settings.LegacyAuthorityOverride;

public bool IsWindowsIntegratedAuthenticationEnabled => settings.IsWindowsIntegratedAuthenticationEnabled;

public bool IsCertificateVerificationEnabled => settings.IsCertificateVerificationEnabled;

public bool AutomaticallyUseClientCertificates => settings.AutomaticallyUseClientCertificates;

public string ParentWindowId => settings.ParentWindowId;

public string CustomCertificateBundlePath => settings.CustomCertificateBundlePath;

public string CustomCookieFilePath => settings.CustomCookieFilePath;

public TlsBackend TlsBackend => settings.TlsBackend;

public bool UseCustomCertificateBundleWithSchannel => settings.UseCustomCertificateBundleWithSchannel;

public int AutoDetectProviderTimeout => settings.AutoDetectProviderTimeout;

public bool UseSoftwareRendering => settings.UseSoftwareRendering;

public bool AllowUnsafeRemotes => settings.AllowUnsafeRemotes;

public void Dispose() => settings.Dispose();
public ProxyConfiguration GetProxyConfiguration() => settings.GetProxyConfiguration();
public Trace2Settings GetTrace2Settings() => settings.GetTrace2Settings();
#endregion
}
}
92 changes: 0 additions & 92 deletions src/CredentialManager/NoGit.cs

This file was deleted.

Loading
Loading