Function: vc-git-previous-revision

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

Signature

(vc-git-previous-revision FILE REV)

Documentation

Git-specific version of vc-previous-revision.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc-git.el.gz
;;; MISCELLANEOUS

(defun vc-git-previous-revision (file rev)
  "Git-specific version of `vc-previous-revision'."
  (if file
      (let* ((fname (file-relative-name file))
             (prev-rev (with-temp-buffer
                         (and
                          (vc-git--out-ok "rev-list" "-2" rev "--" fname)
                          (goto-char (point-max))
                          (bolp)
                          (zerop (forward-line -1))
                          (not (bobp))
                          (buffer-substring-no-properties
                           (point)
                           (1- (point-max)))))))
        (or (vc-git-symbolic-commit prev-rev) prev-rev))
    ;; We used to use "^" here, but that fails on MS-Windows if git is
    ;; invoked via a batch file, in which case cmd.exe strips the "^"
    ;; because it is a special character for cmd which process-file
    ;; does not (and cannot) quote.
    (vc-git--rev-parse (concat rev "~1"))))