 (defun git-run-ls-files-cached (status files default-state)
   "Run git-ls-files -c on FILES and parse the results into STATUS.
 Return the list of files that haven't been handled."
-  (let (infolist)
+  (let ((remaining (copy-sequence files))
+	infolist)
     (with-temp-buffer
       (apply #'git-call-process-env t nil "ls-files" "-z" "-s" "-c" "--" files)
       (goto-char (point-min))

                (push (git-create-fileinfo 'deleted name 0 0 'rename new-name) infolist)
                (push (git-create-fileinfo 'added new-name old-perm new-perm 'rename name) infolist))
            (push (git-create-fileinfo (git-state-code state) name old-perm new-perm) infolist))
          (setq files (delete name files))
          (when new-name (setq files (delete new-name files))))))
    (git-insert-info-list status infolist)
    files))

(defun git-find-status-file (status file)
  "Find a given file in the status ewoc and return its node."

(defun git-run-diff-index (status files)
  "Run git-diff-index on FILES and parse the results into STATUS.
Return the list of files that haven't been handled."
  (let ((remaining (copy-sequence files))
	infolist)
    (with-temp-buffer
      (apply #'git-call-process-env t nil "diff-index" "-z" "-M" "HEAD" "--" files)
      (goto-char (point-min))
