Skip to content

Commit 4cd696a

Browse files
committed
Fix remote and upstream branch if upstream isn't <remote>/<branch>
Fixes #7
1 parent f1b7dba commit 4cd696a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/git_chain/commands/push.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ def run(options)
3636
branch_remote, upstream_branch = upstream.split('/', 2)
3737
if remote && branch_remote != remote
3838
raise(Abort, "Multiple remotes detected: #{remote}, #{branch_remote}") if remote != branch_remote
39-
else
39+
elsif upstream_branch
4040
remote = branch_remote
4141
end
4242
upstreams[b] = upstream_branch
43-
elsif options[:set_upstream]
44-
upstreams[b] = b
4543
end
44+
45+
upstreams[b] ||= b if options[:set_upstream]
4646
end
4747

4848
raise(Abort, "Nothing to push") if upstreams.empty?

0 commit comments

Comments
 (0)