Commit 846e8618 authored by Jonas Bernoulli's avatar Jonas Bernoulli

magit-push-current-to-upstream: fix configuring the upstream

parent 7b6a9801
......@@ -435,14 +435,20 @@ upstream can be changed before pushed to it."
(interactive
(list (magit-push-arguments)
(and (magit--push-current-set-upstream-p current-prefix-arg)
(magit-read-remote (format "Set upstream of %s and push there"
(magit-get-current-branch))))))
(magit-read-remote-branch
(format "Set upstream of %s and push there"
(magit-get-current-branch))))))
(--if-let (magit-get-current-branch)
(progn (when upstream
(magit-call-git "branch" (concat "--set-upstream-to=" upstream)))
(-if-let (target (magit-get-upstream-branch it))
(magit-git-push it target args)
(user-error "No upstream is configured for %s" it)))
(progn
(when upstream
(-let (((remote . merge) (magit-split-branch-name upstream))
(branch (magit-get-current-branch)))
(magit-call-git "config" (format "branch.%s.remote" branch) remote)
(magit-call-git "config" (format "branch.%s.merge" branch)
(concat "refs/heads/" merge))))
(-if-let (target (magit-get-upstream-branch it))
(magit-git-push it target args)
(user-error "No upstream is configured for %s" it)))
(user-error "No branch is checked out")))
(defun magit--push-current-set-upstream-p (&optional change)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment