Function: vc-git--with-temp-index

vc-git--with-temp-index is a macro defined in vc-git.el.gz.

Signature

(vc-git--with-temp-index &rest BODY)

Documentation

Execute BODY with a temporary Git index file.

After executing, delete the temporary index. The index starts empty; callers may populate it with, e.g., 'git read-tree HEAD'.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc-git.el.gz
(defmacro vc-git--with-temp-index (&rest body)
  "Execute BODY with a temporary Git index file.
After executing, delete the temporary index.  The index starts empty;
callers may populate it with, e.g., \\='git read-tree HEAD\\='."
  (declare (indent 0) (debug t))
  (cl-with-gensyms (index)
    `(let ((,index (make-nearby-temp-file "git-index")))
       (unwind-protect
           ;; Use `file-local-name' to strip the TRAMP prefix
           ;; from the index.
           (with-environment-variables
               (("GIT_INDEX_FILE" (file-local-name ,index)))
             ,@body)
         (delete-file ,index)))))