From 2b9e7ca14e5e231c316d6dac6d66bfe9d1f5b83f Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 21 Jan 2014 20:13:08 -0800 Subject: [PATCH] core: merge default synced folders ,don't override [GH-2873] --- CHANGELOG.md | 2 ++ lib/vagrant/action/builtin/mixin_synced_folders.rb | 3 ++- test/unit/vagrant/action/builtin/mixin_synced_folders_test.rb | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f5937c11..c88cafcb5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,6 +60,8 @@ BUG FIXES: indefinitely. [GH-2756] - core: Windows checks home directory permissions more correctly to warn of potential issues. + - core: Synced folders set to the default synced folder explicitly won't + be deleted. [GH-2873] - commands/box: Box add `--force` works with `--provider` flag. [GH-2757] - commands/box: Listing boxes with machine-readable output crash is gone. - commands/plugin: Plugin installation will fail if dependencies conflict, diff --git a/lib/vagrant/action/builtin/mixin_synced_folders.rb b/lib/vagrant/action/builtin/mixin_synced_folders.rb index 5bdc287a8..dbe76cd20 100644 --- a/lib/vagrant/action/builtin/mixin_synced_folders.rb +++ b/lib/vagrant/action/builtin/mixin_synced_folders.rb @@ -96,7 +96,8 @@ module Vagrant raise Errors::NoDefaultSyncedFolderImpl, types: types end - folders[default_impl] = folders[""] + folders[default_impl] ||= {} + folders[default_impl].merge!(folders[""]) folders.delete("") end diff --git a/test/unit/vagrant/action/builtin/mixin_synced_folders_test.rb b/test/unit/vagrant/action/builtin/mixin_synced_folders_test.rb index d24063109..224fa5e30 100644 --- a/test/unit/vagrant/action/builtin/mixin_synced_folders_test.rb +++ b/test/unit/vagrant/action/builtin/mixin_synced_folders_test.rb @@ -75,12 +75,14 @@ describe Vagrant::Action::Builtin::MixinSyncedFolders do it "should return the proper set of folders" do folders["root"] = {} folders["another"] = { type: "" } + folders["foo"] = { type: "default" } folders["nfs"] = { type: "nfs" } result = subject.synced_folders(machine) result.length.should == 2 result[:default].should == { "another" => folders["another"], + "foo" => folders["foo"], "root" => folders["root"], } result[:nfs].should == { "nfs" => folders["nfs"] }