diff --git a/lib/shipit/stack_commands.rb b/lib/shipit/stack_commands.rb index 587d06a1b..5ac91015e 100644 --- a/lib/shipit/stack_commands.rb +++ b/lib/shipit/stack_commands.rb @@ -16,7 +16,7 @@ def env def fetch_commit(commit) create_directories if valid_git_repository?(@stack.git_path) - git('fetch', 'origin', '--quiet', '--tags', commit.sha, env: env, chdir: @stack.git_path) + git('fetch', 'origin', '--quiet', '--tags', '--force', commit.sha, env: env, chdir: @stack.git_path) else @stack.clear_git_cache! git_clone(@stack.repo_git_url, @stack.git_path, branch: @stack.branch, env: env, chdir: @stack.deploys_path) @@ -26,7 +26,7 @@ def fetch_commit(commit) def fetch create_directories if valid_git_repository?(@stack.git_path) - git('fetch', 'origin', '--quiet', '--tags', @stack.branch, env: env, chdir: @stack.git_path) + git('fetch', 'origin', '--quiet', '--tags', '--force', @stack.branch, env: env, chdir: @stack.git_path) else @stack.clear_git_cache! git_clone(@stack.repo_git_url, @stack.git_path, branch: @stack.branch, env: env, chdir: @stack.deploys_path) diff --git a/test/unit/deploy_commands_test.rb b/test/unit/deploy_commands_test.rb index 9b446565c..8610053d7 100644 --- a/test/unit/deploy_commands_test.rb +++ b/test/unit/deploy_commands_test.rb @@ -27,7 +27,7 @@ def setup command = @commands.fetch_commit(@deploy.until_commit) - assert_equal %W(git fetch origin --quiet --tags #{@deploy.until_commit.sha}), command.args + assert_equal %W(git fetch origin --quiet --tags --force #{@deploy.until_commit.sha}), command.args end test "#fetch_commit calls git fetch in git_path directory if repository cache already exist" do @@ -121,7 +121,7 @@ def setup command = @commands.fetch - assert_equal %w(git fetch origin --quiet --tags master), command.args + assert_equal %w(git fetch origin --quiet --tags --force master), command.args end test "#fetch calls git fetch in git_path directory if repository cache already exist" do