Function: vc-git-file-name-changes

vc-git-file-name-changes is a byte-compiled function defined in vc-git.el.gz.

Signature

(vc-git-file-name-changes REV)

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc-git.el.gz
(defun vc-git-file-name-changes (rev)
  (with-temp-buffer
    (let ((root (vc-git-root default-directory)))
      (unless vc-git-print-log-follow
        (apply #'vc-git-command (current-buffer) t nil
               "diff"
               "--name-status"
               "--diff-filter=ADCR"
               (concat rev "^") rev
               (vc-switches 'git 'file-name-changes)))
      (let (res)
        (goto-char (point-min))
        (while (re-search-forward "^\\([ADCR]\\)[0-9]*\t\\([^\n\t]+\\)\\(?:\t\\([^\n\t]+\\)\\)?" nil t)
          (pcase (match-string 1)
            ("A" (push (cons nil (match-string 2)) res))
            ("D" (push (cons (match-string 2) nil) res))
            ((or "C" "R") (push (cons (match-string 2) (match-string 3)) res))
            ;; ("M" (push (cons (match-string 1) (match-string 1)) res))
            ))
        (mapc (lambda (c)
                (if (car c) (setcar c (expand-file-name (car c) root)))
                (if (cdr c) (setcdr c (expand-file-name (cdr c) root))))
              res)
        (nreverse res)))))