Michael Heerdegen
unread,Feb 8, 2016, 9:40:14 AM2/8/16Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ma...@googlegroups.com
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.