Commit 1721f4b6 authored by Jonas Bernoulli's avatar Jonas Bernoulli

magit-push-implicitly: restore command

This command was removed earlier, but it turned out that it is still
required for certain work-flows.  Restore the command, but do not add it
to the push popup again.  If the user follows the instructions on how to
add the command to the popup, then that now shows what the command will
do.
parent c46226b8
......@@ -47,6 +47,11 @@ Changes since v2.3.0
Likewise many commands were renamed and their behavior was adjusted.
Some new commands, related to the push-remote, were added. #2414
* The command `magit-push-implicitly' was removed from the push popup.
The command's doc-string explains how to put it back. If these
instructions are followed, then the popup shows what will happen if
the command is used. #2453
* The option `magit-push-always-verify' was removed. That was only a
temporary kludge to keep users from shooting themselves in the foot.
This is no longer necessary because one now always sees were one is
......@@ -62,9 +67,6 @@ Changes since v2.3.0
* The options `magit-clone-set-branch.pushDefault' and
`magit-remote-add-set-branch.pushDefault' were added. #2447
* The command `magit-push-implicitly', Magit's equivalent of `git
push', was removed. #2414
* When Git is run for side-effects and exits with a non-zero status,
then the respective error message is now inserted into the status
buffer. This should help those users who do not see that message
......
......@@ -3941,6 +3941,17 @@ Also see [[info:gitman#git-push]].
Push a tag to another repository.
- Command: magit-push-implicitly args
Push somewhere without using an explicit refspec.
This command simply runs ~git push -v [ARGS]~. ARGS are the arguments
specified in the popup buffer. No explicit refspec arguments are
used. Instead the behavior depends on at least these Git variables:
~push.default~, ~branch.pushDefault~, ~branch.<branch>.pushRemote~,
~branch.<branch>.remote~, ~branch.<branch>.merge~, and
~remote.<remote>.push~.
- User Option: magit-push-current-set-remote-if-missing
This option controls whether missing remotes are configured before
......
......@@ -5542,6 +5542,19 @@ Push a tag to another repository.
@end table
@cindex magit-push-implicitly args
@deffn Command magit-push-implicitly args
Push somewhere without using an explicit refspec.
This command simply runs @code{git push -v [ARGS]}. ARGS are the arguments
specified in the popup buffer. No explicit refspec arguments are
used. Instead the behavior depends on at least these Git variables:
@code{push.default}, @code{branch.pushDefault}, @code{branch.<branch>.pushRemote},
@code{branch.<branch>.remote}, @code{branch.<branch>.merge}, and
@code{remote.<remote>.push}.
@end deffn
@defopt magit-push-current-set-remote-if-missing
This option controls whether missing remotes are configured before
......
......@@ -520,6 +520,58 @@ branch as default."
(run-hooks 'magit-credential-hook)
(magit-run-git-async-no-revert "push" remote tag args))
;;;###autoload
(defun magit-push-implicitly (args)
"Push somewhere without using an explicit refspec.
This command simply runs \"git push -v [ARGS]\". ARGS are the
arguments specified in the popup buffer. No explicit refspec
arguments are used. Instead the behavior depends on at least
these Git variables: `push.default', `branch.pushDefault',
`branch.<branch>.pushRemote', `branch.<branch>.remote',
`branch.<branch>.merge', and `remote.<remote>.push'.
To add this command to the push popup add this to your init file:
(with-eval-after-load \\='magit-remote
(magit-define-popup-action \\='magit-push-popup ?P
'magit-push-implicitly--desc
'magit-push-implicitly ?p t))
The function `magit-push-implicitly--desc' attempts to predict
what this command will do, the value it returns is displayed in
the popup buffer."
(interactive (list (magit-push-arguments)))
(run-hooks 'magit-credential-hook)
(magit-run-git-async-no-revert "push" "-v" args))
(defun magit-push-implicitly--desc ()
(let ((default (magit-get "push.default")))
(unless (equal default "nothing")
(or (-when-let* ((remote (or (magit-get-remote)
(magit-remote-p "origin")))
(refspec (magit-get "remote" remote "push")))
(format "%s using %s"
(propertize remote 'face 'magit-branch-remote)
(propertize refspec 'face 'bold)))
(--when-let (and (not (magit-get-push-branch))
(magit-get-upstream-branch))
(format "%s aka %s\n"
(magit-branch-set-face it)
(propertize "@{upstream}" 'face 'bold)))
(--when-let (magit-get-push-branch)
(format "%s aka %s\n"
(magit-branch-set-face it)
(propertize "pushRemote" 'face 'bold)))
(--when-let (magit-get-@{push}-branch)
(format "%s aka %s\n"
(magit-branch-set-face it)
(propertize "@{push}" 'face 'bold)))
(format "using %s (%s is %s)\n"
(propertize "git push" 'face 'bold)
(propertize "push.default" 'face 'bold)
(propertize default 'face 'bold))))))
;;; Email
;;;###autoload (autoload 'magit-patch-popup "magit-remote" nil t)
......
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