help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GIT_DIR unset in vc-git.el


From: Emre Yolcu
Subject: GIT_DIR unset in vc-git.el
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?

Best,
Emre




reply via email to

[Prev in Thread] Current Thread [Next in Thread]