Skip to content

Revert "Add support for macOS enterprise deployable default settings" #1913

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
33 changes: 1 addition & 32 deletions docs/enterprise-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,38 +55,7 @@ those of the [Git configuration][config] settings.
The type of each registry key can be either `REG_SZ` (string) or `REG_DWORD`
(integer).

## macOS

Default settings values come from macOS's preferences system. Configuration
profiles can be deployed to devices using a compatible Mobile Device Management
(MDM) solution.

Configuration for Git Credential Manager must take the form of a dictionary, set
for the domain `git-credential-manager` under the key `configuration`. For
example:

```shell
defaults write git-credential-manager configuration -dict-add <key> <value>
```

..where `<key>` is the name of the settings from the [Git configuration][config]
reference, and `<value>` is the desired value.

All values in the `configuration` dictionary must be strings. For boolean values
use `true` or `false`, and for integer values use the number in string form.

To read the current configuration:

```console
$ defaults read git-credential-manager configuration
{
<key1> = <value1>;
...
<keyN> = <valueN>;
}
```

## Linux
## macOS/Linux

Default configuration setting stores has not been implemented.

Expand Down
66 changes: 0 additions & 66 deletions src/shared/Core.Tests/Interop/MacOS/MacOSPreferencesTests.cs

This file was deleted.

2 changes: 1 addition & 1 deletion src/shared/Core/CommandContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public CommandContext()
gitPath,
FileSystem.GetCurrentDirectory()
);
Settings = new MacOSSettings(Environment, Git, Trace);
Settings = new Settings(Environment, Git);
}
else if (PlatformUtils.IsLinux())
{
Expand Down
1 change: 0 additions & 1 deletion src/shared/Core/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public static class Constants

public const string GcmDataDirectoryName = ".gcm";

public const string MacOSBundleId = "git-credential-manager";
public static readonly Guid DevBoxPartnerId = new("e3171dd9-9a5f-e5be-b36c-cc7c4f3f3bcf");

/// <summary>
Expand Down
33 changes: 25 additions & 8 deletions src/shared/Core/Interop/MacOS/MacOSKeychain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -302,18 +302,35 @@ private static string GetStringAttribute(IntPtr dict, IntPtr key)
return null;
}

if (CFDictionaryGetValueIfPresent(dict, key, out IntPtr value) && value != IntPtr.Zero)
IntPtr buffer = IntPtr.Zero;
try
{
if (CFGetTypeID(value) == CFStringGetTypeID())
if (CFDictionaryGetValueIfPresent(dict, key, out IntPtr value) && value != IntPtr.Zero)
{
return CFStringToString(value);
if (CFGetTypeID(value) == CFStringGetTypeID())
{
int stringLength = (int)CFStringGetLength(value);
int bufferSize = stringLength + 1;
buffer = Marshal.AllocHGlobal(bufferSize);
if (CFStringGetCString(value, buffer, bufferSize, CFStringEncoding.kCFStringEncodingUTF8))
{
return Marshal.PtrToStringAuto(buffer, stringLength);
}
}

if (CFGetTypeID(value) == CFDataGetTypeID())
{
int length = CFDataGetLength(value);
IntPtr ptr = CFDataGetBytePtr(value);
return Marshal.PtrToStringAuto(ptr, length);
}
}

if (CFGetTypeID(value) == CFDataGetTypeID())
}
finally
{
if (buffer != IntPtr.Zero)
{
int length = CFDataGetLength(value);
IntPtr ptr = CFDataGetBytePtr(value);
return Marshal.PtrToStringAuto(ptr, length);
Marshal.FreeHGlobal(buffer);
}
}

Expand Down
96 changes: 0 additions & 96 deletions src/shared/Core/Interop/MacOS/MacOSPreferences.cs

This file was deleted.

67 changes: 0 additions & 67 deletions src/shared/Core/Interop/MacOS/MacOSSettings.cs

This file was deleted.

Loading