branch: elpa/git-commit
commit eb0b81e71d04615b3db96d0bb7feb755a998d2fa
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>

    Remove obsolete advice for Tramp
    
    Since Emacs 25.1 [1: cd22fd754b7] Tramp respects let-bound additions to
    `process-environment' on its own.  It uses "env" for that purpose, like
    our advice did.  This could result in two calls to "env" being used.
    
    (`tramp-sh-handle-start-file-process' was replace with
    `tramp-handle-start-file-process' in Emacs 27.1 [2: a94ac604d8c], so
    in that case our advice for the former didn't do anything anymore.)
    
    Closes #5109.
    
    1: 2014-11-22 cd22fd754b71ff64bbabd05bb6df2df8fa5a8915
       Propagate remote process environment.
    
    2: 2018-12-24 a94ac604d8c9848b0414ade80a1920b345161656
       Provide tramp-sh-handle-make-process
---
 lisp/magit-git.el     | 11 ++---------
 lisp/magit-process.el | 22 +---------------------
 2 files changed, 3 insertions(+), 30 deletions(-)

diff --git a/lisp/magit-git.el b/lisp/magit-git.el
index 580043043b..b8c07d0d6b 100644
--- a/lisp/magit-git.el
+++ b/lisp/magit-git.el
@@ -2421,8 +2421,6 @@ and this option only controls what face is used.")
         (point-min) (point-max) buffer-file-name t nil nil t)
        ,@body)))
 
-(defvar magit-tramp-process-environment nil)
-
 (defmacro magit-with-temp-index (tree arg &rest body)
   (declare (indent 2) (debug (form form body)))
   (let ((file (cl-gensym "file")))
@@ -2436,13 +2434,8 @@ and this option only controls what face is used.")
                (unless (magit-git-success "read-tree" ,arg tree
                                           (concat "--index-output=" ,file))
                  (error "Cannot read tree %s" tree)))
-             (if (file-remote-p default-directory)
-                 (let ((magit-tramp-process-environment
-                        (cons (concat "GIT_INDEX_FILE=" ,file)
-                              magit-tramp-process-environment)))
-                   ,@body)
-               (with-environment-variables (("GIT_INDEX_FILE" ,file))
-                 ,@body)))
+             (with-environment-variables (("GIT_INDEX_FILE" ,file))
+               ,@body))
          (ignore-errors
            (delete-file (concat (file-remote-p default-directory) ,file)))))))
 
diff --git a/lisp/magit-process.el b/lisp/magit-process.el
index ae2bf1fb22..e80d9926e4 100644
--- a/lisp/magit-process.el
+++ b/lisp/magit-process.el
@@ -451,8 +451,7 @@ conversion."
 (defun magit-process-environment ()
   ;; The various w32 hacks are only applicable when running on the local
   ;; machine.  A local binding of process-environment different from the
-  ;; top-level value affects the environment used in
-  ;; tramp-sh-handle-{start-file-process,process-file}.
+  ;; top-level value affects the environment used by Tramp.
   (let ((local (not (file-remote-p default-directory))))
     (append magit-git-environment
             (and local
@@ -1019,25 +1018,6 @@ as argument."
 
 (add-hook 'magit-credential-hook #'magit-maybe-start-credential-cache-daemon)
 
-(define-advice tramp-sh-handle-start-file-process
-    (:around (fn name buffer program &rest args)
-             magit-tramp-process-environment)
-  (if magit-tramp-process-environment
-      (apply fn name buffer
-             (car magit-tramp-process-environment)
-             (append (cdr magit-tramp-process-environment)
-                     (cons program args)))
-    (apply fn name buffer program args)))
-
-(define-advice tramp-sh-handle-process-file
-    (:around (fn program &optional infile destination display &rest args)
-             magit-tramp-process-environment)
-  (if magit-tramp-process-environment
-      (apply fn "env" infile destination display
-             (append magit-tramp-process-environment
-                     (cons program args)))
-    (apply fn program infile destination display args)))
-
 (defvar-keymap magit-mode-line-process-map
   :doc "Keymap for `mode-line-process'."
   "<mode-line> <mouse-1>" 'magit-process-buffer)

Reply via email to