unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Emre Yolcu <mail@emreyolcu.com>
To: help-gnu-emacs@gnu.org
Subject: GIT_DIR unset in vc-git.el
Date: Mon, 29 Apr 2024 13:17:15 -0400	[thread overview]
Message-ID: <4642F29A-5933-4728-AEEA-83E60ED2BD23@emreyolcu.com> (raw)

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	other threads:[~2024-04-29 17:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-29 17:17 Emre Yolcu [this message]
2024-04-30 12:55 ` GIT_DIR unset in vc-git.el 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4642F29A-5933-4728-AEEA-83E60ED2BD23@emreyolcu.com \
    --to=mail@emreyolcu.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).