From f74db2f96f0ec4362e6ad341c4f34a1d597c718d Mon Sep 17 00:00:00 2001 From: Jeremy Bopp Date: Mon, 22 Feb 2016 17:12:43 -0600 Subject: [PATCH] Prune old tracking branches from the repository during update --- CHANGELOG.md | 2 ++ lib/capistrano/git.rb | 2 +- spec/lib/capistrano/git_spec.rb | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 16a22034..4141af79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ https://github.com/capistrano/capistrano/compare/v3.4.0...HEAD * Drop support for Ruby 1.9.3 (Capistrano may still work with 1.9.3, but it is no longer officially supported) * Added new runtime option `--print-config-variables` that inspect all defined config variables in order to assist development of new capistrano tasks (@gerardo-navarro) +* Prune dead tracking branches from git repositories while updating + * Git version 1.6.3 or greater is now required * Minor changes * Fix filtering behaviour when using literal hostnames in on() block (@townsen) diff --git a/lib/capistrano/git.rb b/lib/capistrano/git.rb index 18298531..f430b39e 100644 --- a/lib/capistrano/git.rb +++ b/lib/capistrano/git.rb @@ -34,7 +34,7 @@ class Capistrano::Git < Capistrano::SCM if (depth = fetch(:git_shallow_clone)) git :fetch, '--depth', depth, 'origin', fetch(:branch) else - git :remote, :update + git :remote, :update, '--prune' end end diff --git a/spec/lib/capistrano/git_spec.rb b/spec/lib/capistrano/git_spec.rb index 1e1f3a33..9ca0545d 100644 --- a/spec/lib/capistrano/git_spec.rb +++ b/spec/lib/capistrano/git_spec.rb @@ -61,7 +61,7 @@ module Capistrano describe "#update" do it "should run git update" do context.expects(:fetch).with(:git_shallow_clone).returns(nil) - context.expects(:execute).with(:git, :remote, :update) + context.expects(:execute).with(:git, :remote, :update, '--prune') subject.update end