diff --git a/lib/r10k/git/rugged/working_repository.rb b/lib/r10k/git/rugged/working_repository.rb index a5bc44b38..ed1d82e4a 100644 --- a/lib/r10k/git/rugged/working_repository.rb +++ b/lib/r10k/git/rugged/working_repository.rb @@ -89,7 +89,7 @@ def fetch(remote_name = 'origin') remote = remotes[remote_name] proxy = R10K::Git.get_proxy_for_remote(remote) - options = {:credentials => credentials, :proxy_url => proxy} + options = {:credentials => credentials, :proxy_url => proxy, :prune => true} refspecs = ["+refs/heads/*:refs/remotes/#{remote_name}/*"] results = nil diff --git a/lib/r10k/git/shellgit/thin_repository.rb b/lib/r10k/git/shellgit/thin_repository.rb index 850e110a8..e748e78f3 100644 --- a/lib/r10k/git/shellgit/thin_repository.rb +++ b/lib/r10k/git/shellgit/thin_repository.rb @@ -31,7 +31,7 @@ def clone(remote, opts = {}) # Fetch refs from the backing bare Git repository. def fetch(remote = 'cache') - git ['fetch', remote], :path => @path.to_s + git ['fetch', remote, '--prune'], :path => @path.to_s end # @return [String] The origin remote URL