From 6d476386cf278105cf3c41414392ecb90c2bb00a Mon Sep 17 00:00:00 2001 From: Roland Moriz Date: Fri, 6 Apr 2018 12:58:28 +0200 Subject: prune remotes with git fetch, fixes #3929 Signed-off-by: Roland Moriz --- spec/unit/provider/git_spec.rb | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'spec') diff --git a/spec/unit/provider/git_spec.rb b/spec/unit/provider/git_spec.rb index cacee0baaa..c32c2ee146 100644 --- a/spec/unit/provider/git_spec.rb +++ b/spec/unit/provider/git_spec.rb @@ -425,9 +425,9 @@ SHAS it "runs a sync command with default options" do expect(@provider).to receive(:setup_remote_tracking_branches).with(@resource.remote, @resource.repository) - expected_cmd1 = "git fetch origin" + expected_cmd1 = "git fetch --prune origin" expect(@provider).to receive(:shell_out!).with(expected_cmd1, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]") - expected_cmd2 = "git fetch origin --tags" + expected_cmd2 = "git fetch --prune-tags origin --tags" expect(@provider).to receive(:shell_out!).with(expected_cmd2, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]") expected_cmd3 = "git reset --hard d35af14d41ae22b19da05d7d03a0bafc321b244c" expect(@provider).to receive(:shell_out!).with(expected_cmd3, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]") @@ -440,12 +440,12 @@ SHAS @resource.group("thisis") expect(@provider).to receive(:setup_remote_tracking_branches).with(@resource.remote, @resource.repository) - expected_cmd1 = "git fetch origin" + expected_cmd1 = "git fetch --prune origin" expect(@provider).to receive(:shell_out!).with(expected_cmd1, :cwd => "/my/deploy/dir", :user => "whois", :group => "thisis", :log_tag => "git[web2.0 app]", :environment => { "HOME" => "/home/whois" }) - expected_cmd2 = "git fetch origin --tags" + expected_cmd2 = "git fetch --prune-tags origin --tags" expect(@provider).to receive(:shell_out!).with(expected_cmd2, :cwd => "/my/deploy/dir", :user => "whois", :group => "thisis", :log_tag => "git[web2.0 app]", @@ -461,9 +461,9 @@ SHAS it "configures remote tracking branches when remote is ``origin''" do @resource.remote "origin" expect(@provider).to receive(:setup_remote_tracking_branches).with(@resource.remote, @resource.repository) - fetch_command1 = "git fetch origin" + fetch_command1 = "git fetch --prune origin" expect(@provider).to receive(:shell_out!).with(fetch_command1, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]") - fetch_command2 = "git fetch origin --tags" + fetch_command2 = "git fetch --prune-tags origin --tags" expect(@provider).to receive(:shell_out!).with(fetch_command2, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]") fetch_command3 = "git reset --hard d35af14d41ae22b19da05d7d03a0bafc321b244c" expect(@provider).to receive(:shell_out!).with(fetch_command3, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]") @@ -473,9 +473,9 @@ SHAS it "configures remote tracking branches when remote is not ``origin''" do @resource.remote "opscode" expect(@provider).to receive(:setup_remote_tracking_branches).with(@resource.remote, @resource.repository) - fetch_command1 = "git fetch opscode" + fetch_command1 = "git fetch --prune opscode" expect(@provider).to receive(:shell_out!).with(fetch_command1, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]") - fetch_command2 = "git fetch opscode --tags" + fetch_command2 = "git fetch --prune-tags opscode --tags" expect(@provider).to receive(:shell_out!).with(fetch_command2, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]") fetch_command3 = "git reset --hard d35af14d41ae22b19da05d7d03a0bafc321b244c" expect(@provider).to receive(:shell_out!).with(fetch_command3, :cwd => "/my/deploy/dir", :log_tag => "git[web2.0 app]") -- cgit v1.2.1