Skip to content

Commit

Permalink
Merge pull request #3969 from rubygems/no_deinit_warn
Browse files Browse the repository at this point in the history
Don't warn when deinit'ing submodules

(cherry picked from commit 73ba6e1)
  • Loading branch information
deivid-rodriguez committed Oct 5, 2020
1 parent 3ccbe3e commit 70044e9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bundler/lib/bundler/source/git/git_proxy.rb
Expand Up @@ -136,7 +136,9 @@ def copy_to(destination, submodules = false)
if submodules
git_retry "submodule update --init --recursive", :dir => destination
elsif Gem::Version.create(version) >= Gem::Version.create("2.9.0")
git_retry "submodule deinit --all --force", :dir => destination
inner_command = "git -C $toplevel submodule deinit --force $sm_path"
inner_command = inner_command.gsub("$") { '\$' } unless Bundler::WINDOWS
git_retry "submodule foreach --quiet \"#{inner_command}\"", :dir => destination
end
end

Expand Down
18 changes: 18 additions & 0 deletions bundler/spec/install/gemfile/git_spec.rb
Expand Up @@ -864,6 +864,24 @@
expect(the_bundle).to include_gems "has_submodule 1.0"
end

it "does not warn when deiniting submodules" do
build_git "submodule", "1.0"
build_git "has_submodule", "1.0"

sys_exec "git submodule add #{lib_path("submodule-1.0")} submodule-1.0", :dir => lib_path("has_submodule-1.0")
sys_exec "git commit -m \"submodulator\"", :dir => lib_path("has_submodule-1.0")

install_gemfile <<-G
git "#{lib_path("has_submodule-1.0")}" do
gem "has_submodule"
end
G
expect(err).to be_empty

expect(the_bundle).to include_gems "has_submodule 1.0"
expect(the_bundle).to_not include_gems "submodule 1.0"
end

it "handles implicit updates when modifying the source info" do
git = build_git "foo"

Expand Down

0 comments on commit 70044e9

Please sign in to comment.