mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Separate VCS::GIT#upstream
This commit is contained in:
parent
2e6f777f9e
commit
47144f91a1
1 changed files with 9 additions and 4 deletions
|
@ -578,9 +578,7 @@ class VCS
|
|||
IO.copy_stream(r, path)
|
||||
end
|
||||
|
||||
def commit(opts = {})
|
||||
args = [COMMAND, "push"]
|
||||
args << "-n" if dryrun
|
||||
def upstream
|
||||
(branch = cmd_read(%W"#{COMMAND} symbolic-ref --short HEAD")).chomp!
|
||||
(upstream = cmd_read(%W"#{COMMAND} branch --list --format=%(upstream) #{branch}")).chomp!
|
||||
while ref = upstream[%r"\Arefs/heads/(.*)", 1]
|
||||
|
@ -589,7 +587,14 @@ class VCS
|
|||
unless %r"\Arefs/remotes/([^/]+)/(.*)" =~ upstream
|
||||
raise "Upstream not found"
|
||||
end
|
||||
args << $1 << "HEAD:#$2"
|
||||
[$1, $2]
|
||||
end
|
||||
|
||||
def commit(opts = {})
|
||||
args = [COMMAND, "push"]
|
||||
args << "-n" if dryrun
|
||||
remote, branch = upstream
|
||||
args << remote << "HEAD:#{branch}"
|
||||
if dryrun?
|
||||
STDERR.puts(args.inspect)
|
||||
return true
|
||||
|
|
Loading…
Reference in a new issue