bin/git-merge-pr in git-merge-pr-0.3.0 vs bin/git-merge-pr in git-merge-pr-0.4.0
- old
+ new
@@ -17,10 +17,13 @@
require 'rugged'
abort "Provide a PR number (no '#' tho)" if ARGV.empty?
pr_num = ARGV.first
-remote = Rugged::Repository.new(Rugged::Repository.discover(Dir.pwd)).remotes.first.url
+
+remote_name = ENV.fetch("REMOTE_NAME", "origin")
+remotes = Rugged::Repository.new(Rugged::Repository.discover(Dir.pwd)).remotes
+remote = remotes.find{ |r| r.name.eql?(remote_name) }.url
remote.sub!("git@github.com:", "https://github.com/")
remote.sub!(/\.git$/, "")
client = Octokit::Client.new(netrc: true)
repo = Octokit::Repository.from_url(remote)