unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* GIT_DIR unset in vc-git.el
@ 2024-04-29 17:17 Emre Yolcu
  2024-04-30 12:55 ` Stefan Monnier via Users list for the GNU Emacs text editor
  2024-04-30 12:55 ` Eli Zaretskii
  0 siblings, 2 replies; 5+ messages in thread
From: Emre Yolcu @ 2024-04-29 17:17 UTC (permalink / raw)
  To: help-gnu-emacs

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




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-04-30 20:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-29 17:17 GIT_DIR unset in vc-git.el Emre Yolcu
2024-04-30 12:55 ` Stefan Monnier via Users list for the GNU Emacs text editor
2024-04-30 20:12   ` Emre Yolcu
2024-04-30 20:38     ` Stefan Monnier
2024-04-30 12:55 ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).