Commit bcdfe08b authored by Jonas Bernoulli's avatar Jonas Bernoulli

magit-with-temp-index: Read-tree at toplevel

`git-read-tree' expects to be used at the repository root.

Fixes #3631.
parent 7e1c00c0
......@@ -1749,19 +1749,20 @@ the reference is used. The first regexp submatch becomes the
(,file (magit-convert-filename-for-git
(make-temp-name (magit-git-dir "index.magit.")))))
(unwind-protect
(progn (--when-let ,tree
(or (magit-git-success "read-tree" ,arg it
(concat "--index-output=" ,file))
(error "Cannot read tree %s" it)))
(if (file-remote-p default-directory)
(let ((magit-tramp-process-environment
(cons (concat "GIT_INDEX_FILE=" ,file)
magit-tramp-process-environment)))
,@body)
(let ((process-environment
(cons (concat "GIT_INDEX_FILE=" ,file)
process-environment)))
,@body)))
(magit-with-toplevel
(--when-let ,tree
(or (magit-git-success "read-tree" ,arg it
(concat "--index-output=" ,file))
(error "Cannot read tree %s" it)))
(if (file-remote-p default-directory)
(let ((magit-tramp-process-environment
(cons (concat "GIT_INDEX_FILE=" ,file)
magit-tramp-process-environment)))
,@body)
(let ((process-environment
(cons (concat "GIT_INDEX_FILE=" ,file)
process-environment)))
,@body)))
(ignore-errors
(delete-file (concat (file-remote-p default-directory) ,file)))))))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment