From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Re: A project-files implementation for Git projects Date: Tue, 10 Sep 2019 08:25:17 +0200 Message-ID: <87mufcfz1u.fsf@gnu.org> References: <8736h9rdc4.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="96914"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 10 08:26:10 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1i7ZbN-000P5o-Jy for ged-emacs-devel@m.gmane.org; Tue, 10 Sep 2019 08:26:09 +0200 Original-Received: from localhost ([::1]:34114 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7ZbL-0001ge-Va for ged-emacs-devel@m.gmane.org; Tue, 10 Sep 2019 02:26:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37017) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i7Zae-0001fv-90 for emacs-devel@gnu.org; Tue, 10 Sep 2019 02:25:25 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:49803) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1i7Zad-0002M9-TW; Tue, 10 Sep 2019 02:25:23 -0400 Original-Received: from auth1-smtp.messagingengine.com ([66.111.4.227]:52815) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.82) (envelope-from ) id 1i7Zab-0002Mz-CR; Tue, 10 Sep 2019 02:25:23 -0400 Original-Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailauth.nyi.internal (Postfix) with ESMTP id 8D9F621FF3; Tue, 10 Sep 2019 02:25:20 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Tue, 10 Sep 2019 02:25:20 -0400 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrudekjedguddtfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufhffjgfkfgggtgesthdtredttdertdenucfhrhhomhepvfgrshhs ihhlohcujfhorhhnuceothhsughhsehgnhhurdhorhhgqeenucfkphepudefgedruddule drvdegrdduleehnecurfgrrhgrmhepmhgrihhlfhhrohhmpehthhhorhhnodhmvghsmhht phgruhhthhhpvghrshhonhgrlhhithihqdekieejfeekjeekgedqieefhedvleekqdhtsh guhheppehgnhhurdhorhhgsehfrghsthhmrghilhdrfhhmnecuvehluhhsthgvrhfuihii vgeptd X-ME-Proxy: Original-Received: from jiffyarch (j289989.servers.jiffybox.net [134.119.24.195]) by mail.messagingengine.com (Postfix) with ESMTPA id D5C17D6005F; Tue, 10 Sep 2019 02:25:19 -0400 (EDT) In-Reply-To: (Stefan Monnier's message of "Fri, 06 Sep 2019 08:52:50 -0400") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:239974 Archived-At: Stefan Monnier writes: >> (cl-defmethod project-files ((project (head vc)) &optional dirs) >> "Implementation of `project-files' for Git projects." >> (cl-mapcan >> (lambda (dir) >> (if-let ((git (and (file-exists-p >> (expand-file-name ".git/config" dir)) >> (executable-find "git")))) > > Since it's a handler for `vc` it should handle all VC backends. To do > that, it can simply use the `vc-call-backend` mechanism, so the > Git-specific code can be put inside vc-git and you can have a generic > implementation that does just the `cl-call-next-method`. I didn't know that mechanism, so I have some more questions. Would that mean that I would need to add functions vc-git-list-files (using: git ls-files) vc-hg-list-files (using: hg files) ... for all backends which support listing tracked files? And then project-files would call (vc-call-backend backend 'list-files) and if that signals vc-not-supported call cl-call-next-method? But how do I know the right backend without explicit tests? vc-backend wants a file and all I have is the project's directory. Also, I think most vc backends have a way to list tracked files but not all those are faster than find is. "git ls-files" is much faster than find but short testing revealed that "hg files" is much slower. I don't think it would be a good idea to use it in project-files where speed is important. So name the vc function vc--list-files-fast and only provide an implementation for Git? Thanks, Tassilo