Function: vc-git--pushpull
vc-git--pushpull is a byte-compiled function defined in vc-git.el.gz.
Signature
(vc-git--pushpull COMMAND PROMPT EXTRA-ARGS)
Documentation
Run COMMAND (a string; either push or pull) on the current Git branch.
If PROMPT is non-nil, prompt for the Git command to run.
Source Code
;; Defined in /usr/src/emacs/lisp/vc/vc-git.el.gz
(defun vc-git--pushpull (command prompt extra-args)
"Run COMMAND (a string; either push or pull) on the current Git branch.
If PROMPT is non-nil, prompt for the Git command to run."
(require 'vc-dispatcher)
(let* ((root (vc-git-root default-directory))
(buffer (format "*vc-git : %s*" (expand-file-name root)))
(git-program vc-git-program)
;; TODO if pushing, prompt if no default push location - cf bzr.
(vc-filter-command-function
(if prompt
(lambda (&rest args)
(cl-destructuring-bind (&whole args git _ flags)
(apply #'vc-user-edit-command args)
(setq git-program git
command (car flags)
extra-args (cdr flags))
args))
vc-filter-command-function))
(proc (apply #'vc-do-async-command
buffer root git-program command extra-args)))
;; "git pull" includes progress output that uses ^M to move point
;; to the beginning of the line. Just translate these to newlines
;; (but don't do anything with the CRLF sequence).
(add-function :around (process-filter proc)
(lambda (filter process string)
(funcall filter process
(replace-regexp-in-string "\r\\(\\'\\|[^\n]\\)"
"\n\\1" string))))
(with-current-buffer buffer
(vc-run-delayed
(vc-compilation-mode 'git)
(setq-local compile-command
(concat git-program " " command " "
(mapconcat #'identity extra-args " ")))
(setq-local compilation-directory root)
;; Either set `compilation-buffer-name-function' locally to nil
;; or use `compilation-arguments' to set `name-function'.
;; See `compilation-buffer-name'.
(setq-local compilation-arguments
(list compile-command nil
(lambda (_name-of-mode) buffer)
nil))))
(vc-set-async-update buffer)
;; Return the process for `vc-pull-and-push'
proc))