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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add start_point option for checkout command #597

Merged
merged 1 commit into from Oct 5, 2022

Conversation

Vasfed
Copy link
Contributor

@Vasfed Vasfed commented Sep 27, 2022

Your checklist for this pull request

馃毃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

This adds support for start-point git option when creating a new branch during checkout.
Fixes #249

Copy link
Member

@jcouball jcouball left a comment

Choose a reason for hiding this comment

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

Hello @Vasfed! Thank you for this pull request.

I do have some requested changes in my review comments. In addition to those changes, can you also update the README.md to mention that this flag is supported?

Also, the build fails on Windows which you can see here:
https://github.com/ruby-git/ruby-git/actions/runs/3138166086/jobs/5154249814#step:4:41

===============================================================================
Error: test_checkout(TestLib):
  Git::GitExecuteError: git "--git-dir=D:/tmp/git_test1664642165171/working/.git" "--work-tree=D:/tmp/git_test1664642165171/working" "-c" "core.quotePath=true" "-c" "color.ui=false" checkout "-b" "test_checkout_b2" "master"  2>&1:error: Your local changes to the following files would be overwritten by checkout:
  	colon_numbers.txt
  	example.txt
  	scott/newfile
  	scott/text.txt
  Please commit your changes or stash them before you switch branches.
  Aborting
D:/a/ruby-git/ruby-git/lib/git/lib.rb:1144:in `command'
D:/a/ruby-git/ruby-git/lib/git/lib.rb:783:in `checkout'
D:/a/ruby-git/ruby-git/tests/units/test_lib.rb:86:in `test_checkout'
     83:
     84:   def test_checkout
     85:     assert(@lib.checkout('test_checkout_b',{:new_branch=>true}))
  => 86:     assert(@lib.checkout('test_checkout_b2', {new_branch: true, start_point: 'master'}))
     87:     assert(@lib.checkout('.'))
     88:     assert(@lib.checkout('master'))
     89:   end
===============================================================================

lib/git/lib.rb Outdated Show resolved Hide resolved
tests/units/test_lib.rb Outdated Show resolved Hide resolved
jcouball
jcouball previously approved these changes Oct 5, 2022
Copy link
Member

@jcouball jcouball left a comment

Choose a reason for hiding this comment

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

Looks great! Thank you for the PR and the changes.

Co-authored-by: V.Kolesnikov <re.vkolesnikov@gmail.com>
Signed-off-by: Vasily Fedoseyev <vasilyfedoseyev@gmail.com>
@Vasfed
Copy link
Contributor Author

Vasfed commented Oct 5, 2022

Fixed tests on windows

Copy link
Member

@jcouball jcouball left a comment

Choose a reason for hiding this comment

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

I had missed the build errors during my last review but did notice them before merging.

Thank you for proactively fixing the problem.

@jcouball jcouball merged commit 74b8e11 into ruby-git:master Oct 5, 2022
@jcouball jcouball mentioned this pull request Dec 14, 2022
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.

Create a new branch from a startpoint?
2 participants