Skip to content
New issue

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

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

Already on GitHub? # to your account

Make the system installer always append GCM Core entries, not outright set/replace existing values (and fix a typo) #203

Merged
merged 8 commits into from
Nov 2, 2020

Conversation

mjcheetham
Copy link
Collaborator

@mjcheetham mjcheetham commented Oct 29, 2020

Rather than set the helper to be only GCM Core in the system configuration when called with (un)configure --system, we do what we are already doing in the user-case.
We only append an empty ("") reset entry, and then the GCM full path entry. This means on uninstall of the standalone GCM (be that the system or user install), we restore the previous entry, always.

Catch more existing config cases such as when another 'empty' entry is after GCM. We will now see this case and reconfigure ourselves to be exclusively 'in front'.

Also we are not that meta.. "Git Credential Manager Manager Core". Whoops.

@mjcheetham mjcheetham added bug A bug in Git Credential Manager platform:windows Specific to the Windows platform installation Specific to installation and uninstallation labels Oct 29, 2020
@dscho
Copy link
Collaborator

dscho commented Oct 29, 2020

Maybe s/type/typo/ in this PR's title? :-)

Rather than set the helper to be _only_ GCM Core in the system
configuration when called with `(un)configure --system`, we do what we
are already doing in the user-case.

We only append an empty ("") reset entry, and then the GCM full path
entry. This means on uninstall of the standalone GCM (be that the system
or user install), we restore the previous entry, always.
@mjcheetham mjcheetham changed the title Fix a type in the user Windows installer Make the system installer always append GCM Core entries, not outright set/replace existing values (and fix a typo) Oct 29, 2020
string.IsNullOrWhiteSpace(currentValues[appIndex - 1]))
{
// Clear the blank entry
config.UnsetAll(helperKey, Constants.RegexPatterns.Empty);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if there are multiple empty entries?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not entirely sure what we can do here to identify a specific line in a config file, that matches the same value, using only git config commands. Any ideas?

Add the --get-all and --add Git configuration commands, and use them in
place of --get-regexp and --replace-all where applicable.
If we have empty helper entries after GCM, then we should attempt to
reconfigure to put GCM back "at the front", since otherwise it's
effectively being disabled by those subsequent empty entries.
@mjcheetham mjcheetham requested a review from dscho October 29, 2020 17:36
@mjcheetham
Copy link
Collaborator Author

Sorry @dscho, requesting yet another review..

Only clear the useHttpPath=true option on calls to unconfigure if the
"manager-core" option is not present and we're in the system config on a
Windows platform.

This would be the case for the bundled GCM Core in Git for Windows,
which we would break by removing this option.
Since --null means that each config entry terminates with a null
character ('\0') we are left with one extra entry in the array after
splitting the string. This is NOT a real entry and we shouldn't return
it from the method.
@mjcheetham mjcheetham merged commit ff1043f into git-ecosystem:master Nov 2, 2020
@mjcheetham mjcheetham deleted the fixtypowin branch November 2, 2020 13:10
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug A bug in Git Credential Manager installation Specific to installation and uninstallation platform:windows Specific to the Windows platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants