Skip to content

Commit

Permalink
Fix git repo initialization on a path with spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Aug 4, 2021
1 parent 36a0014 commit a2d6e10
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bundler/lib/bundler/cli/gem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ def run

if use_git
Bundler.ui.info "Initializing git repo in #{target}"
`git init #{target}`
require "shellwords"
`git init #{target.to_s.shellescape}`

config[:git_default_branch] = File.read("#{target}/.git/HEAD").split("/").last.chomp
end
Expand Down
11 changes: 11 additions & 0 deletions bundler/spec/commands/newgem_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,17 @@ def bundle_exec_standardrb
gem_skeleton_assertions
expect(bundled_app("#{gem_name}/.git")).not_to exist
end

context "on a path with spaces" do
before do
Dir.mkdir(bundled_app("path with spaces"))
end

it "properly initializes git repo", :readline do
bundle "gem #{gem_name}", :dir => bundled_app("path with spaces")
expect(bundled_app("path with spaces/#{gem_name}/.git")).to exist
end
end
end

shared_examples_for "--mit flag" do
Expand Down

0 comments on commit a2d6e10

Please sign in to comment.