summaryrefslogtreecommitdiff
path: root/lib/bundler/gem_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler/gem_helper.rb')
-rw-r--r--lib/bundler/gem_helper.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/bundler/gem_helper.rb b/lib/bundler/gem_helper.rb
index 4ada36aef4..0acaa69f25 100644
--- a/lib/bundler/gem_helper.rb
+++ b/lib/bundler/gem_helper.rb
@@ -117,13 +117,13 @@ module Bundler
def git_push(remote = nil)
remote ||= default_remote
perform_git_push remote
- perform_git_push "#{remote} #{version_tag}"
+ perform_git_push "#{remote} refs/tags/#{version_tag}"
Bundler.ui.confirm "Pushed git commits and release tag."
end
def default_remote
- current_branch = sh(%w[git rev-parse --abbrev-ref HEAD]).strip
- return "origin" if current_branch.empty?
+ # We can replace this with `git branch --show-current` once we drop support for git < 2.22.0
+ current_branch = sh(%w[git rev-parse --abbrev-ref HEAD]).gsub(%r{\Aheads/}, "").strip
remote_for_branch = sh(%W[git config --get branch.#{current_branch}.remote]).strip
return "origin" if remote_for_branch.empty?