Change how the git CLI subprocess is executed#684
Merged
Conversation
7321c6f to
44a04c5
Compare
Signed-off-by: James Couball <jcouball@yahoo.com>
44a04c5 to
320c548
Compare
This was referenced Jan 15, 2024
Merged
Merged
jcouball
added a commit
that referenced
this pull request
Mar 19, 2024
Signed-off-by: James Couball <jcouball@yahoo.com>
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.
Your checklist for this pull request
🚨Please review the guidelines for contributing to this repository.
TODO
Issue #687 was opened to track that this gem does not work on JRuby for Windows when using JDK > 8. This PR will be merged without this issue being solved.
Waiting for the following issues to be addressed:
Description
Fixes the following issues:
In the current implementation, all calls to
gitare done using backticks which has several disadvantages:Requirements
Implement a cross platform (Windows, Linux, and Mac) and cross Ruby (MRI, JRuby, and TruffleRuby) solution that meets the following requirements:
gitcommand subprocess that does not change these global variables in the process that this gem is running ingitcommand without being interpreted by the system shellAlternative Implementations Examined
Option 6 was chosen because it is the least complex implementation that implements all the requirements.
Changes Made in this PR
This PR re-implements
Git::Lib#command. In order to get the desired results, some changes were needed to the signature of this method which caused some changes in code and tests.The implementation of
Git::Lib#commandis handled by the new classGit::CommandLine. This class has a small interface:#initializewhich accepts attribute values that do not change between git command invocations (env, binary_path, global_opts, and logger) and#runwhich takes the git command args, redirection, and flags for normalization, chomping, and merging stderr with stdout.