Skip to content

Refactor tests for Git::Lib methods #read_tree, #write_tree, and #commit_tree #679

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

Merged
merged 1 commit into from
Dec 26, 2023

Conversation

jcouball
Copy link
Member

Checklist

🚨Please review the guidelines for contributing to this repository.

  • Ensure all commits include DCO sign-off.
  • Ensure that your contributions pass unit testing.
  • Ensure that your contributions contain documentation if applicable.

Description

Refactor tests in test/units/test_tree_ops.rb for Git::Lib#read_tree, write_tree, and commit_tree.

This is to fix these tests from failing on JRuby on Windows for PR #673 after some changes were made to remove calls to Dir.chdir. I believe the tests were failing due to how temporary directories were created and doing that in JRuby on Windows caused git to error out.

The refactor consists of limiting the tests to make sure that when the previously mentioned Git::Lib methods are called, that git is called with the right arguments without actually running git. In other words, the tests test this lib and not git itself or edge cases of the platform it is running on.

I have left the original tests in the code, commented out as an example of how these methods might be used.

Also, in writing these tests, I found that when Git::Lib#commit_tree is called with an array of commit SHAs for the parents argument, the command line was constructed incorrectly. This PR fixes that behavior.

After this PR is merged to master, PR #673 should be rebased with master and its tests should pass which should make it ready for review and merge.

Signed-off-by: James Couball <jcouball@yahoo.com>
@jcouball jcouball changed the title Refactor tests for read_tree, write_tree, and commit_tree Refactor tests for Git::Lib methods #read_tree, #write_tree, and #commit_tree Dec 26, 2023
@jcouball jcouball merged commit e64c2f6 into master Dec 26, 2023
@jcouball jcouball deleted the refactor_test_tree_ops branch December 26, 2023 23:22
This was referenced Dec 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant