From b67764560cc350dbf2e20f66954bdd0a9bda9f5b 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 [Bump after signing cla] --- 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 9464786..ca258d7 100644 --- a/lib/git_chain/commands/push.rb +++ b/lib/git_chain/commands/push.rb @@ -33,13 +33,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?