Function: vc-git-incoming-revision

vc-git-incoming-revision is a byte-compiled function defined in vc-git.el.gz.

Signature

(vc-git-incoming-revision &optional UPSTREAM-LOCATION REFRESH)

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc-git.el.gz
(defun vc-git-incoming-revision (&optional upstream-location refresh)
  (let ((remotes (and (not upstream-location) (vc-git--branch-remotes))))
    (and-let* ((rev (or upstream-location
                        (cdr (assq 'push remotes))
                        (cdr (assq 'upstream remotes)))))
      (when (or refresh (null (vc-git--rev-parse rev)))
        (vc-git-command nil 0 nil "fetch"
                        ;; Extract remote from "remote/branch".
                        (replace-regexp-in-string "/.*" "" rev)))
      (ignore-errors          ; in order to return nil if no such branch
        (with-output-to-string
          (vc-git-command standard-output 0 nil
                          "log" "--max-count=1" "--pretty=format:%H" rev))))))