Skip to content

Commit 4d40338

Browse files
committed
a little addition to deal "checkout file" with this checkout method
1 parent 8121703 commit 4d40338

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/git/lib.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def clone(repository, name, opts = {})
5757
arr_opts << '--'
5858
arr_opts << repository
5959
arr_opts << clone_dir
60-
60+
6161
command('clone', arr_opts)
6262

6363
opts[:bare] ? {:repository => clone_dir} : {:working_directory => clone_dir}
@@ -521,12 +521,16 @@ def checkout(branch, opts = {})
521521
arr_opts << opts[:new_branch] if opts[:new_branch] && !opts[:new_branch].is_a?(TrueClass)
522522
#
523523

524-
arr_opts << branch
524+
arr_opts << branch if branch
525525

526526
# -- we can 'git checkout `sha`' now
527527
arr_opts << opts[:commit] if opts[:commit]
528528
#
529529

530+
# -- checkout paths
531+
arr_opts.push '--', *opts[:files] if opts[:files]
532+
#
533+
530534
command('checkout', arr_opts)
531535
end
532536

0 commit comments

Comments
 (0)