[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GIT_DIR unset in vc-git.el
From: |
Eli Zaretskii |
Subject: |
Re: GIT_DIR unset in vc-git.el |
Date: |
Tue, 30 Apr 2024 15:55:32 +0300 |
> From: Emre Yolcu <mail@emreyolcu.com>
> Date: Mon, 29 Apr 2024 13:17:15 -0400
>
> Hi,
>
> In vc-git.el, the function vc-git--call unsets GIT_DIR before calling git.
> What is the reason for this? I am curious because I use a bare Git
> repository to manage my home directory, and this involves temporarily
> modifying GIT_DIR and GIT_WORK_TREE. More specifically, I use the function
> below, which keeps a modified environment for the duration of the
> recursive edit.
>
> (defun git-link-home ()
> (interactive)
> (let ((process-environment
> `(,(format "GIT_DIR=%s" (expand-file-name "~/.home.git/"))
> ,(format "GIT_WORK_TREE=%s" (expand-file-name "~/"))
> ,@process-environment)))
> (recursive-edit)))
>
> This works fine for Magit, but not for VC. In particular, the Git branch
> information that is displayed in the mode line disappears because VC
> unsets GIT_DIR before calling git. Is there any harm in changing
> vc-git--call to not do that?
See bug#23769 for the reasons why we remove GIT_DIR from the
environment.