diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 224b2e8..69dff78 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -20,6 +20,10 @@ on:
env:
DOTNET_NOLOGO: true
SLEET_CONNECTION: ${{ secrets.SLEET_CONNECTION }}
+ MSBUILDTERMINALLOGGER: auto
+ GH_TOKEN: ${{ secrets.GH_TOKEN }}
+ Configuration: ${{ github.event.inputs.configuration || 'Release' }}
+ SLEET_FEED_URL: ${{ vars.SLEET_FEED_URL }}
defaults:
run:
@@ -98,8 +102,16 @@ jobs:
name: pkg
path: bin
+ - name: ⚙ dotnet
+ uses: devlooped/actions-dotnet-env@v1
+
+ - name: 🙏 build
+ run: dotnet build
+
- name: 🧪 test
- run: dotnet test --nologo -bl --logger:"console;verbosity=normal"
+ run: |
+ dotnet tool update -g dotnet-retest
+ dotnet retest -- --no-build
- name: 🐛 logs
uses: actions/upload-artifact@v4
diff --git a/src/CredentialManager/CredentialManager.cs b/src/CredentialManager/CredentialManager.cs
index 55bcea7..6469eb0 100644
--- a/src/CredentialManager/CredentialManager.cs
+++ b/src/CredentialManager/CredentialManager.cs
@@ -1,5 +1,10 @@
using System;
using System.Collections.Generic;
+using System.IO;
+using System.Runtime.InteropServices;
+using DotNetConfig;
+using KnownEnvars = GitCredentialManager.Constants.EnvironmentVariables;
+using KnownGitCfg = GitCredentialManager.Constants.GitConfiguration;
namespace GitCredentialManager;
@@ -68,8 +73,60 @@ class CommandContextWrapper(CommandContext context, string? @namespace) : IComma
class SettingsWrapper(ISettings settings, string? @namespace) : ISettings
{
+ static readonly Config gitconfig;
+
+ static SettingsWrapper()
+ {
+ string homeDir;
+
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ homeDir = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
+ }
+ else
+ {
+ // On Linux/Mac it's $HOME
+ homeDir = Environment.GetEnvironmentVariable("HOME")
+ ?? Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
+ }
+
+ gitconfig = Config.Build(Path.Combine(homeDir, ".gitconfig"));
+ }
+
+ static bool TryGetWrappedSetting(string envarName, string section, string property, out string value)
+ {
+ if (envarName != null && Environment.GetEnvironmentVariable(envarName) is { Length: > 0 } envvar)
+ {
+ value = envvar;
+ return true;
+ }
+
+ return gitconfig.TryGetString(section, property, out value);
+ }
+
// Overriden namespace to scope credential operations.
- public string CredentialNamespace => @namespace ?? settings.CredentialNamespace;
+ public string CredentialNamespace => @namespace ?? (
+ TryGetWrappedSetting(KnownEnvars.GcmCredNamespace,
+ KnownGitCfg.Credential.SectionName, KnownGitCfg.Credential.CredNamespace,
+ out var ns) ? ns : Constants.DefaultCredentialNamespace);
+
+ public string CredentialBackingStore =>
+ TryGetWrappedSetting(
+ KnownEnvars.GcmCredentialStore,
+ KnownGitCfg.Credential.SectionName,
+ KnownGitCfg.Credential.CredentialStore,
+ out string credStore)
+ ? credStore
+ : null!;
+
+ public bool UseMsAuthDefaultAccount =>
+ TryGetWrappedSetting(
+ KnownEnvars.MsAuthUseDefaultAccount,
+ KnownGitCfg.Credential.SectionName,
+ KnownGitCfg.Credential.MsAuthUseDefaultAccount,
+ out string str)
+ ? str.IsTruthy()
+ : PlatformUtils.IsDevBox(); // default to true in DevBox environment
#region pass-through impl.
@@ -99,8 +156,6 @@ class SettingsWrapper(ISettings settings, string? @namespace) : ISettings
public string ParentWindowId => settings.ParentWindowId;
- public string CredentialBackingStore => settings.CredentialBackingStore;
-
public string CustomCertificateBundlePath => settings.CustomCertificateBundlePath;
public string CustomCookieFilePath => settings.CustomCookieFilePath;
@@ -111,8 +166,6 @@ class SettingsWrapper(ISettings settings, string? @namespace) : ISettings
public int AutoDetectProviderTimeout => settings.AutoDetectProviderTimeout;
- public bool UseMsAuthDefaultAccount => settings.UseMsAuthDefaultAccount;
-
public bool UseSoftwareRendering => settings.UseSoftwareRendering;
public bool AllowUnsafeRemotes => settings.AllowUnsafeRemotes;
diff --git a/src/CredentialManager/CredentialManager.csproj b/src/CredentialManager/CredentialManager.csproj
index 4b894d2..483553a 100644
--- a/src/CredentialManager/CredentialManager.csproj
+++ b/src/CredentialManager/CredentialManager.csproj
@@ -17,6 +17,7 @@
+
@@ -28,11 +29,7 @@
-
+
@@ -42,7 +39,7 @@
$(ILRepackArgs) "@(IntermediateAssembly -> '%(FullPath)')"
$(ILRepackArgs) @(MergedAssemblies -> '"%(FullPath)"', ' ')
-
+
@@ -54,8 +51,7 @@
-
+
diff --git a/src/Tests/Tests.csproj b/src/Tests/Tests.csproj
index 82f9748..4c4fab1 100644
--- a/src/Tests/Tests.csproj
+++ b/src/Tests/Tests.csproj
@@ -15,7 +15,7 @@
-
+