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."
  (let* ((root (vc-git-root default-directory))
	 (buffer (format "*vc-git : %s*" (expand-file-name root)))
	 (git-program vc-git-program)
	 args)
    ;; If necessary, prompt for the exact command.
    ;; TODO if pushing, prompt if no default push location - cf bzr.
    (when prompt
      (setq args (split-string
		  (read-shell-command
                   (format "Git %s command: " command)
                   (format "%s %s" git-program command)
                   'vc-git-history)
		  " " t))
      (setq git-program (car  args)
	    command     (cadr args)
	    args        (cddr args)))
    (setq args (nconc args extra-args))
    (require 'vc-dispatcher)
    (apply #'vc-do-async-command buffer root git-program command args)
    (with-current-buffer buffer
      (vc-run-delayed
        (vc-compilation-mode 'git)
        (setq-local compile-command
                    (concat git-program " " command " "
                            (mapconcat #'identity 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)))