Hey,

and here's a patch that changes magit-push to call 'git push' without an
explicit refspec argument if 'magit-push' is called without C-u and if
the local branch has a remote configured. Otherwise it behaves as
before.

Regards,
Mosu

-- 
If Darl McBride was in charge, he'd probably make marriage
unconstitutional too, since clearly it de-emphasizes the commercial
nature of normal human interaction, and probably is a major impediment
to the commercial growth of prostitution. - Linus Torvalds

diff --git a/magit.el b/magit.el
index a533c58..6ce66a4 100644
--- a/magit.el
+++ b/magit.el
@@ -2354,15 +2354,19 @@ in log buffer."
   (let* ((branch (or (magit-get-current-branch)
 		     (error "Don't push a detached head. That's gross.")))
 	 (branch-remote (magit-get "branch" branch "remote"))
-	 (push-remote (if (or current-prefix-arg
-			      (not branch-remote))
+	 (explicit-remote-branch (or current-prefix-arg
+				     (not branch-remote)))
+	 (push-remote (if explicit-remote-branch
 			  (magit-read-remote (format "Push %s to" branch)
 					     branch-remote)
-			branch-remote)))
+			branch-remote))
+	 (args (list "push" "-v" push-remote)))
+    (if explicit-remote-branch
+	(nconc args (list branch)))
     (if (and (not branch-remote)
 	     (not current-prefix-arg))
 	(magit-set push-remote "branch" branch "remote"))
-    (magit-run-git-async "push" "-v" push-remote branch)))
+    (apply 'magit-run-git-async args)))
 
 ;;; Log edit mode
 

Reply via email to