提交 d7d954a8 编写于 作者: M Mislav Marohnić

fix push multiple refs to multiple remotes

Fixes #207
上级 610ffc14
......@@ -544,12 +544,18 @@ module Hub
def push(args)
return if args[1].nil? || !args[1].index(',')
branch = (args[2] ||= current_branch.short_name)
refs = args.words[2..-1]
remotes = args[1].split(',')
args[1] = remotes.shift
if refs.empty?
# add current branch as explicit ref when there are no refs specified
refs = [current_branch.short_name]
args.concat refs
end
remotes.each do |name|
args.after ['push', name, branch]
args.after ['push', name, *refs]
end
end
......
......@@ -245,6 +245,12 @@ class HubTest < Test::Unit::TestCase
"push origin,staging,qa cool-feature"
end
def test_push_multiple_refs
assert_commands "git push origin master new-feature",
"git push staging master new-feature",
"push origin,staging master new-feature"
end
def test_pullrequest
expected = "Aborted: head branch is the same as base (\"master\")\n" <<
"(use `-h <branch>` to specify an explicit pull request head)\n"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册