summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Moriz <roland@moriz.de>2018-05-10 15:43:29 +0200
committerRoland Moriz <roland@moriz.de>2018-05-10 15:47:49 +0200
commitc9146c2b026b06c1eeeee82ba2650506999feee5 (patch)
treeec1a9d3f901690f29aecb6348a8cbd31f5718d1f
parentd252c0eabeaae40d8a369c934354edf2dcc731ab (diff)
downloadchef-c9146c2b026b06c1eeeee82ba2650506999feee5.tar.gz
sadly --prune-tags is not available with old git versions, fixes #7233
Signed-off-by: Roland Moriz <roland@moriz.de>
-rw-r--r--lib/chef/provider/git.rb2
-rw-r--r--spec/unit/provider/git_spec.rb8
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/chef/provider/git.rb b/lib/chef/provider/git.rb
index a14711e2b6..239dfa09e6 100644
--- a/lib/chef/provider/git.rb
+++ b/lib/chef/provider/git.rb
@@ -195,7 +195,7 @@ class Chef
# since we're in a local branch already, just reset to specified revision rather than merge
logger.trace "Fetching updates from #{new_resource.remote} and resetting to revision #{target_revision}"
git("fetch", "--prune", new_resource.remote, cwd: cwd)
- git("fetch", "--prune-tags", new_resource.remote, "--tags", cwd: cwd)
+ git("fetch", new_resource.remote, "--tags", cwd: cwd)
git("reset", "--hard", target_revision, cwd: cwd)
end
end
diff --git a/spec/unit/provider/git_spec.rb b/spec/unit/provider/git_spec.rb
index c32c2ee146..b8a26a3543 100644
--- a/spec/unit/provider/git_spec.rb
+++ b/spec/unit/provider/git_spec.rb
@@ -427,7 +427,7 @@ SHAS
expect(@provider).to receive(:setup_remote_tracking_branches).with(@resource.remote, @resource.repository)
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 --prune-tags origin --tags"
+ expected_cmd2 = "git fetch 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]")
@@ -445,7 +445,7 @@ SHAS
:user => "whois", :group => "thisis",
:log_tag => "git[web2.0 app]",
:environment => { "HOME" => "/home/whois" })
- expected_cmd2 = "git fetch --prune-tags origin --tags"
+ expected_cmd2 = "git fetch 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]",
@@ -463,7 +463,7 @@ SHAS
expect(@provider).to receive(:setup_remote_tracking_branches).with(@resource.remote, @resource.repository)
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 --prune-tags origin --tags"
+ fetch_command2 = "git fetch 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]")
@@ -475,7 +475,7 @@ SHAS
expect(@provider).to receive(:setup_remote_tracking_branches).with(@resource.remote, @resource.repository)
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 --prune-tags opscode --tags"
+ fetch_command2 = "git fetch 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]")