From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#73320: [PATCH] project--vc-list-files: use Git's sparse-index Date: Sat, 5 Oct 2024 00:25:13 +0300 Message-ID: References: <73758f39-1e18-471a-9dfb-0ceade12dacf@gutov.dev> <8e00a62b-c531-4593-90c3-55e060c5434f@gutov.dev> <878qv471ga.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3695"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: Sean Allred , 73320@debbugs.gnu.org To: Michael Albinus , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Oct 04 23:26:16 2024 Return-path: Envelope-to: geb-bug-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 1swpoV-0000jU-CK for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 04 Oct 2024 23:26:15 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1swpoI-0000wI-J4; Fri, 04 Oct 2024 17:26:02 -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 1swpoH-0000wA-2z for bug-gnu-emacs@gnu.org; Fri, 04 Oct 2024 17:26:01 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1swpoF-0005Wv-48 for bug-gnu-emacs@gnu.org; Fri, 04 Oct 2024 17:26:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:From:References:MIME-Version:Date:To:Subject; bh=DgGokpo/cfIpzoB2aJEG8AKQvqnSA2RQKndEX5pw2JM=; b=FJaPd1Sew3cW32RYRtJbggLeCcxSY844CsjqD7EBIjnkU9b1gwcZhcTz4cY1T4qIRIGMMpcLZoO4+zjl7kl0YpqDYgwiQ7Xt4XqnFc+I+ELJwzGtKDTLoW7WVJBqeiB9x/WCo2T6aKXYBqhKkSEMY6eOhxhFZrlPUN28hfQIICj/bgL6lgeIdIf4SFZuGpsj0jCI94+MYHcNq+LEOvMjykddD0204M4zqJK3P7sfv+idFv2yi4DisXkmjhBlT/58gunjmpC/hR1j1wyv6S+X1+Ny6wv+vg0Ag5bgZwKr2fyfP6Ip3aCbav/Lf6yVyP7pn8tNbPbhOW4OrbiQoNugqA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1swpoI-0006My-8D for bug-gnu-emacs@gnu.org; Fri, 04 Oct 2024 17:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 04 Oct 2024 21:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73320 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 73320-submit@debbugs.gnu.org id=B73320.172807712924435 (code B ref 73320); Fri, 04 Oct 2024 21:26:02 +0000 Original-Received: (at 73320) by debbugs.gnu.org; 4 Oct 2024 21:25:29 +0000 Original-Received: from localhost ([127.0.0.1]:36713 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swpnl-0006M2-9Q for submit@debbugs.gnu.org; Fri, 04 Oct 2024 17:25:29 -0400 Original-Received: from fout-a5-smtp.messagingengine.com ([103.168.172.148]:42247) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1swpnk-0006Ln-1m for 73320@debbugs.gnu.org; Fri, 04 Oct 2024 17:25:28 -0400 Original-Received: from phl-compute-07.internal (phl-compute-07.phl.internal [10.202.2.47]) by mailfout.phl.internal (Postfix) with ESMTP id 71AEE13802C9; Fri, 4 Oct 2024 17:25:18 -0400 (EDT) Original-Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-07.internal (MEProxy); Fri, 04 Oct 2024 17:25:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1728077118; x=1728163518; bh=DgGokpo/cfIpzoB2aJEG8AKQvqnSA2RQKndEX5pw2JM=; b= kQd2OgitZKn+6k1J2nlpfUb2nCJBsMYun+hYGXpKCKnn2lgFUALvTGLn/8/OphrD K86n+xheYbSQPebAmwWfVIJi4gNF0tXNb6ohA2yvgJuRqslc0O+Bp1O2qwQmxAl+ DrmDDZX1xTvGyhIGi4GCVhTMtyjIITaXeZ2oVn1jCTJQ4vnTxLIsR8CRGE7LMVKr 9XNc/zhqF+vktyNICHfXgO8rxQD72z/sg7u0nqXfsm4XzNTqmgZ1HAMJFuglz3SJ ucMkToucwIclDocgWYqHbNvfXDqzGvrE5yVE0gCe+9JE2QaF5DFv2NNbKvFL7/n+ ruXWyZkQdAYxWCavKBSGrg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1728077118; x= 1728163518; bh=DgGokpo/cfIpzoB2aJEG8AKQvqnSA2RQKndEX5pw2JM=; b=O QepfeFjZdZ0XW/nLxd2ZP5sspEu0x00MRNJxBhON3m8A5Soq6cBx3UyFkWwAdVu0 mj9DBB5aF1GLDJIAhND5pbAp3yHG9OKxzQXLrgzLXcD5xT3GwFYOf4wekjzMoao1 CnqTRNNJnuJtcpP6CfJQV13hisBGB1o71PQP14ikw+T5xCfb5Uo8oDT2cCm1JPOZ 79lAz4OkmBnGUkT5rScfSei0PkrrqCj1PwUR2mIV5QISxihtfBQhlT2KjCmahZHZ 9jCLqyPvqF+qAjDQ1So0t/yaPKJBRIT+V75lor77RXOfO3+BiWckRX8ViKFPsxt9 kofOG4pys3hpxGm+QNNNA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvddvfedgudeitdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttddv jeenucfhrhhomhepffhmihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrd guvghvqeenucggtffrrghtthgvrhhnpeetudeljeegheetgfehgeejkeeuhedvveeikeeu fedtvddtveefhfdvveegudejheenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmh epmhgrihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvhdpnhgspghrtghpthht ohepgedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepmhhitghhrggvlhdrrghlsg hinhhushesghhmgidruggvpdhrtghpthhtohepvghlihiisehgnhhurdhorhhgpdhrtghp thhtoheprghllhhrvggurdhsvggrnhesghhmrghilhdrtghomhdprhgtphhtthhopeejfe efvddtseguvggssghughhsrdhgnhhurdhorhhg X-ME-Proxy: Feedback-ID: i07de48aa:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Oct 2024 17:25:16 -0400 (EDT) Content-Language: en-US In-Reply-To: <878qv471ga.fsf@gmx.de> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:292979 Archived-At: Hi Michael, Eli, On 04/10/2024 10:48, Michael Albinus wrote: >> It could use some review, though. There aren't many examples of doing >> that in Emacs code. > In Eshell, Jim Porter makes extensive use of connection-local > variables. He has also added some functions which are useful (not > applied in Tramp yet). Yep, Eshell seems to be have been the only other client of connection-local, until now. I was wondering whether setting a unique application name is the recommended pattern, though. > However, you use with-connection-local-variables, which uses the > application `tramp' by default. Either use > with-connection-local-application-variables instead, or let-bind > connection-local-default-application to `vc-git'. > > I'm not sure how setq-connection-local behaves wrt to the application > (this function was written by Jim, I've never used it). But binding > connection-local-default-application should be good enough, I believe. > >> Is the 'connection-local-set-profiles' call needed here at all or can >> be skipped? > It is needed. connection-local-set-profile-variables declares only the > variables, connection-local-set-profiles activates them. Thanks, Michael. Binding connection-local-default-application seems like a good approach for Emacs 27-28, but vc-git is not distributed separately, so might as well use the newer macro. Here's the updated patch. Eli, any chance this can go in Emacs 30? Could be considered a bugfix, since we're fixing Git version detection on remote hosts. Not a regression, though. diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 05400523048..5a7ffeffc9d 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -315,11 +315,21 @@ vc-git--state-code (defvar vc-git--program-version nil) +(connection-local-set-profile-variables + 'vc-git-connection-default-profile + '((vc-git--program-version . nil))) + +(connection-local-set-profiles + '(:application vc-git) + 'vc-git-connection-default-profile) + (defun vc-git--program-version () - (or vc-git--program-version - (let ((version-string - (vc-git--run-command-string nil "version"))) - (setq vc-git--program-version + (with-connection-local-application-variables 'vc-git + (or vc-git--program-version + (let ((version-string + (vc-git--run-command-string nil "version"))) + (setq-connection-local + vc-git--program-version (if (and version-string ;; Some Git versions append additional strings ;; to the numerical version string. E.g., Git @@ -329,7 +339,7 @@ vc-git--program-version (string-match "git version \\([0-9][0-9.]+\\)" version-string)) (string-trim-right (match-string 1 version-string) "\\.") - "0"))))) + "0")))))) (defun vc-git--git-path (&optional path) "Resolve .git/PATH for the current working tree.