Skip to content

Commit

Permalink
Merge pull request Shopify#1357 from Shopify/kwb/force-fetch-tags
Browse files Browse the repository at this point in the history
Add --force to git fetch --tags command
  • Loading branch information
kwboyd-shopify authored Jul 29, 2024
2 parents e968dbe + bb0423f commit a6f1948
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/shipit/stack_commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions test/unit/deploy_commands_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a6f1948

Please sign in to comment.