Conversation
sergiou87
reviewed
May 21, 2024
lib/git-environment.ts
Outdated
| if (process.env.GIT_EXEC_PATH != null) { | ||
| return path.resolve(process.env.GIT_EXEC_PATH) | ||
| function resolveGitExecPath(env: Record<string, string | undefined>): string { | ||
| if (env.GIT_EXEC_PATH != null) { |
Member
There was a problem hiding this comment.
Should this be compared with undefined now? (although I see the != instead of !==)
Suggested change
| if (env.GIT_EXEC_PATH != null) { | |
| if (env.GIT_EXEC_PATH != undefined) { |
Member
Author
There was a problem hiding this comment.
I went with a simple if (env.GIT_EXEC_PATH) instead, let me know if you have a strong preference for !== undefined. In this case I think the empty string comparison gained by a truthy check makes sense, we don't want to resolve for an empty string.
| } | ||
| } | ||
|
|
||
| if (process.platform !== 'win32' && !env.GIT_CONFIG_SYSTEM) { |
Member
There was a problem hiding this comment.
We should probably add a comment here explaining why only on non-Windows platforms 🤔
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ref: desktop/dugite-native#508
This will cause dugite to set the
GIT_CONFIG_SYSTEM(unless set already) to point to the newly created system config in dugite-native. This config file will in turn include the actual system config (/etc/gitconfig).As part of this change I've ensured that all methods that modify the env record that ends up being passed to Git operate on the provided
envjoined withprocess.env. This will allow callers to set their ownGIT_CONFIG_SYSTEMwithout having to resort to modifying the current process' environment.I've also updated the env type to be a more specific
Recordtype instead of the oldobjecttype.Note that we can't merge this until we've published a new version of dugite-native and incorporated it into dugite.