File tree 2 files changed +11
-0
lines changed
2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -764,11 +764,21 @@ def branch_delete(branch)
764
764
command ( 'branch' , '-D' , branch )
765
765
end
766
766
767
+ # Runs checkout command to checkout or create branch
768
+ #
769
+ # accepts options:
770
+ # :new_branch
771
+ # :force
772
+ # :start_point
773
+ #
774
+ # @param [String] branch
775
+ # @param [Hash] opts
767
776
def checkout ( branch , opts = { } )
768
777
arr_opts = [ ]
769
778
arr_opts << '-b' if opts [ :new_branch ] || opts [ :b ]
770
779
arr_opts << '--force' if opts [ :force ] || opts [ :f ]
771
780
arr_opts << branch
781
+ arr_opts << opts [ :start_point ] if opts [ :start_point ] && ( arr_opts . include? ( '-b' ) || arr_opts . include? ( '--force' ) )
772
782
773
783
command ( 'checkout' , arr_opts )
774
784
end
Original file line number Diff line number Diff line change @@ -83,6 +83,7 @@ def test_commit_with_no_verify
83
83
84
84
def test_checkout
85
85
assert ( @lib . checkout ( 'test_checkout_b' , { :new_branch => true } ) )
86
+ assert ( @lib . checkout ( 'test_checkout_b2' , { new_branch : true , start_point : 'master' } ) )
86
87
assert ( @lib . checkout ( '.' ) )
87
88
assert ( @lib . checkout ( 'master' ) )
88
89
end
You can’t perform that action at this time.
0 commit comments