Skip to content
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

Update test of 'git worktree add' with no commits #670

Merged
merged 3 commits into from Sep 18, 2023
Merged

Conversation

jcouball
Copy link
Member

@jcouball jcouball commented Sep 17, 2023

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

Description

git-2.42.0 changes the behavior of git worktree add when there are no commits in the repository. Prior to 2.42.0, an error would result with creating a new worktree. Starting wtih 2.42.0, git will create an orphan branch for the worktree.

Other Changes

This PR also adds Git::Lib#compare_version_to(other_version) which return -1 if the git command version is less than the other_version, 0 if equal, and 1 if greater than.

This PR rewrites tests/units/test_repack.rb to make sure that the correct git command was called without error when Git::Lib#repack is called. Prior to this change, the test actually checked to see if the size of the repository was less after calling repack which was not always the case in the tests.

Signed-off-by: James Couball <jcouball@yahoo.com>
git-2.42.0 changes the behavior of `git worktree add` when there are no commits in the repository. Prior to 2.42.0, an error would result with creating a new worktree. Starting wtih 2.42.0, git will create a new, orphaned branch for the worktree.

Signed-off-by: James Couball <jcouball@yahoo.com>
@jcouball jcouball force-pushed the fix_worktree_test branch 2 times, most recently from 67ca08a to f19d207 Compare September 18, 2023 15:30
Signed-off-by: James Couball <jcouball@yahoo.com>
@jcouball jcouball merged commit b1799f6 into master Sep 18, 2023
9 checks passed
@jcouball jcouball deleted the fix_worktree_test branch September 18, 2023 23:12
@jcouball jcouball mentioned this pull request Dec 29, 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.

None yet

1 participant