From 4cd696a601285f77c4d9daf14b1fba1445474746 Mon Sep 17 00:00:00 2001 From: Ryan Davis Date: Fri, 31 Jul 2020 14:24:13 -0700 Subject: [PATCH] Fix remote and upstream branch if upstream isn't / Fixes #7 --- lib/git_chain/commands/push.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/git_chain/commands/push.rb b/lib/git_chain/commands/push.rb index 086e444..3f63a9e 100644 --- a/lib/git_chain/commands/push.rb +++ b/lib/git_chain/commands/push.rb @@ -36,13 +36,13 @@ def run(options) branch_remote, upstream_branch = upstream.split('/', 2) if remote && branch_remote != remote raise(Abort, "Multiple remotes detected: #{remote}, #{branch_remote}") if remote != branch_remote - else + elsif upstream_branch remote = branch_remote end upstreams[b] = upstream_branch - elsif options[:set_upstream] - upstreams[b] = b end + + upstreams[b] ||= b if options[:set_upstream] end raise(Abort, "Nothing to push") if upstreams.empty?