Hi,

for something I develop, I need a temporary index file - just like
`magit-with-temp-index'.  My version looks like this:

--8<---------------cut here---------------start------------->8---
(defmacro helm-backup-save-index (&rest body)
  ;; Modeled after `magit-with-temp-index'
  (declare (debug t))
  (macroexp-let2 nil
       temp-index-file
      '(expand-file-name (make-temp-name "index.helm-backup"))
    `(unwind-protect
         (let ((process-environment process-environment))
           (setenv "GIT_INDEX_FILE" ,temp-index-file)
           ,@body)
       (when (file-exists-p ,temp-index-file)
          (delete-file ,temp-index-file)))))
--8<---------------cut here---------------end--------------->8---

This works, but in some cases (say 10% of the calls), the temporary
file survives and is not deleted; but there is no error and the code
terminates normally: delete-file is called and succeeds.

I know that `magit-with-temp-index' had the same problem in the past,
but the problem disappeared some while ago.

Is there some trick, or some git setting, to handle this problem?
Does anybody know how Magit got rid of this problem?


Thanks,

Michael.

-- 
You received this message because you are subscribed to the Google Groups 
"magit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to