From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: GIT_DIR unset in vc-git.el Date: Tue, 30 Apr 2024 15:55:32 +0300 Message-ID: <86wmofovqz.fsf@gnu.org> References: <4642F29A-5933-4728-AEEA-83E60ED2BD23@emreyolcu.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="793"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Apr 30 14:55:58 2024 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s1n1Z-000ATA-Va for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 30 Apr 2024 14:55:58 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s1n1J-0006oU-RL; Tue, 30 Apr 2024 08:55:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s1n1G-0006nL-Nl for help-gnu-emacs@gnu.org; Tue, 30 Apr 2024 08:55:38 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s1n1G-0006IJ-Ei for help-gnu-emacs@gnu.org; Tue, 30 Apr 2024 08:55:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=2iKNXh8H6VK1FSHSnkbse5y4zHcWENE2+NknebBk4Tg=; b=am51epL3hkZl 3XQio9whu0VjkCbmye3fzunzu/4dvfgs3UGylobLxZsvFF4ORJ4X08B4mMENvEEl35lR6C7h6O5Hk 3KzFq4AuO/tdwVbvF3SFtiCZW0MsRfsdJjQjnXzWmEehAeG+FH5fua0osWSyeL5ttKhsNtNCmWf0m 0TqiOh18aMiqA0WDsrP4xiiM//LKD/hQo+A0+2QkuBJAGGZKbyuruGiKzq1CXvCYzGFB/oYyiBdk6 +0i42HzNDiZGrMvu0nRCLlQNtog1prMrJ1irqESj9oRvdAyxeVRVB4MpxeDzkiQQB9KoLFctJj/NS z2cMkKkbWNLXdQpDOO/BgQ==; In-Reply-To: <4642F29A-5933-4728-AEEA-83E60ED2BD23@emreyolcu.com> (message from Emre Yolcu on Mon, 29 Apr 2024 13:17:15 -0400) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:146514 Archived-At: > From: Emre Yolcu > 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.