Zach Jibben via <[email protected]> writes:

Hi,

> This reproduces with `emacs -Q`.
>
> A value added to a buffer-local `process-environment` is not
> propagated to a process executed through TRAMP.
>
> Steps to reproduce:
>
> 1. Start:
>
>    emacs -Q
>
> 2. Visit any directory on an SSH host, for example:
>
>    C-x C-f /ssh:HOST:/tmp/ RET
>
> 3. Evaluate:
>
>    (let ((dir default-directory)
>          (env (cons "MAGIT_TRAMP_TEST=yes" process-environment)))
>      (with-temp-buffer
>        (setq default-directory dir)
>        (setq-local process-environment env)
>        (process-file "sh" nil t nil "-c"
>                      "printf '%s' \"$MAGIT_TRAMP_TEST\"")
>        (buffer-string)))
>
> Expected result:
>
>    "yes"
>
> Actual result:
>
>    ""
>
> This appears to be a regression related to commit
> 8f5b786cacbc5e85a71b1e2ec530db9feb41e73c
> ("Check buffer-local value in tramp-local-environment-variable-p").
>
> I encountered this through Magit.  Magit uses a buffer-local
> process-environment containing GIT_INDEX_FILE while constructing
> a temporary index for `magit-stash-both`.  Because GIT_INDEX_FILE
> is not propagated to the remote Git process, Magit can create an
> incomplete stash and subsequently discard unstaged changes.
>
> Historically, Magit issue #4160 involved essentially the same
> failure mode when GIT_INDEX_FILE was lost across process buffers.
>
> As a test/workaround, forcing
> `tramp-local-environment-variable-p` to return nil for Magit's
> temporary GIT_INDEX_FILE causes Magit stashing over TRAMP to work
> correctly again.

This change was triggered by bug#81175. Unfortunately, this bug report
doesn't contain a reasoning for the change. Augusto, could you, pls
provide details?

Thanks, and best regards, Michael.

Reply via email to