 (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))

	       (old-perm (if (eq default-state 'added) 0 new-perm))
	       (name (match-string 2)))
	  (push (git-create-fileinfo default-state name old-perm new-perm) infolist)
	  (setq files (delete name files)))))
    (git-insert-info-list status infolist)
    files))

(defun git-run-ls-unmerged (status files)
  "Run git-ls-files -u on FILES and parse the results into STATUS."

(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))
