File tree Expand file tree Collapse file tree 3 files changed +9
-7
lines changed
Expand file tree Collapse file tree 3 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -80,16 +80,17 @@ class << self
8080 # @see https://git-scm.com/docs/git-init git-init
8181 #
8282 # @example
83- # worktree = Worktree.init(worktree_path)
83+ # worktree = Worktree.init(worktree_path, initial_branch: 'main' )
8484 #
85- # @param [String] worktree_path the root path of a worktree
85+ # @param worktree_path [String] the root path of a worktree
86+ # @param initial_branch [String] the initial branch in the newly created repository
8687 #
8788 # @raise [RubyGit::Error] if worktree_path is not a directory
8889 #
8990 # @return [RubyGit::Worktree] the worktree whose root is at `path`
9091 #
91- def self . init ( worktree_path )
92- RubyGit ::Worktree . init ( worktree_path )
92+ def self . init ( worktree_path , initial_branch : )
93+ RubyGit ::Worktree . init ( worktree_path , initial_branch : )
9394 end
9495
9596 # Open an existing Git working tree that contains worktree_path
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ class Worktree
2929 # @see https://git-scm.com/docs/git-init git-init
3030 #
3131 # @example
32- # worktree = Worktree.init(worktree_path)
32+ # worktree = Worktree.init(worktree_path, initial_branch: 'main' )
3333 #
3434 # @param worktree_path [String] the root path of a Git working tree
3535 # @param initial_branch [String] the initial branch in the newly created repository
Original file line number Diff line number Diff line change 4040 end
4141
4242 describe '.init' do
43+ subject { RubyGit . init ( worktree_path , initial_branch :) }
4344 let ( :worktree_path ) { '/Users/jsmith/my_project' }
44- subject { RubyGit . init ( worktree_path ) }
45+ let ( :initial_branch ) { 'xxx' }
4546 it 'should call RubyGit::Worktree.init with the same arguments' do
4647 worktree_class = class_double ( 'RubyGit::Worktree' )
4748 stub_const ( 'RubyGit::Worktree' , worktree_class )
48- expect ( worktree_class ) . to receive ( :init ) . with ( worktree_path )
49+ expect ( worktree_class ) . to receive ( :init ) . with ( worktree_path , initial_branch : )
4950 subject
5051 end
5152 end
You can’t perform that action at this time.
0 commit comments