From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.bugs Subject: bug#61817: 30.0.50; Project.el finds incorrect project roots in git worktrees Date: Mon, 27 Feb 2023 08:32:39 +0100 Message-ID: References: <5dea8e3b-4867-52f8-19fb-9bf5ab167f46@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31883"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 61817@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Feb 27 09:23:51 2023 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 1pWYnW-00082M-2I for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 27 Feb 2023 09:23:50 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWY1a-00067j-5w; Mon, 27 Feb 2023 02:34:18 -0500 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 1pWY1S-00065h-2Y for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2023 02:34:12 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pWY1O-0007wc-68 for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2023 02:34:07 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pWY1K-0002kk-CI for bug-gnu-emacs@gnu.org; Mon, 27 Feb 2023 02:34:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Arthur Miller Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 27 Feb 2023 07:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61817 X-GNU-PR-Package: emacs Original-Received: via spool by 61817-submit@debbugs.gnu.org id=B61817.167748318210506 (code B ref 61817); Mon, 27 Feb 2023 07:34:02 +0000 Original-Received: (at 61817) by debbugs.gnu.org; 27 Feb 2023 07:33:02 +0000 Original-Received: from localhost ([127.0.0.1]:45741 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWY0M-0002jD-02 for submit@debbugs.gnu.org; Mon, 27 Feb 2023 02:33:02 -0500 Original-Received: from mail-he1eur04olkn2056.outbound.protection.outlook.com ([40.92.73.56]:14741 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWY0F-0002ih-Aa for 61817@debbugs.gnu.org; Mon, 27 Feb 2023 02:32:59 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SEABeEN+XtHLjizQR6SLFcvadz6q59gFSEFAq5SMQ9RptiuTsBNnCka3ElnQO6l2WX2hRGo4UmeZ9oikHr/BXAeKlMnp4DKQodWRqOBTZ3ezMa0pjf8VdeUy646KRJa4MqQwlOoLxe+dzo8yeU0NhVFWzeJL/0ZxWXyq7iucsGZMTRFN2LW2ZZ5dBWJIUsebKrgS68NzdD9FkgkneZIZ3MuNiXCoWV8iHP1reWrHBPetrVlJda6RbAbwyqumj68Kr1j9xvHjCSvNNuaiBA5BFPd+12fkDsquvP8Stc8CDvbIgLFn19Qx0fwgDJadYKHKyEIznuE4E+oBvNwqaDGnlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TuPUSpLqaK92IujUVnA7F7bH/Gr7PFU4pcMYQxkBpq0=; b=nZWfCO/MDxWAftG79P5WM4xyL7+4UjxhpOlpP5wDTBrcwgcewhkHNcWqx7jiTWneXgV/KDmPTmSd65Zg/Nc5iORu183RU0OBKa5U+IL5/g+dYisR3kvY9GiezYCgUBezykZX86kMhOR0Mb2sgZ6fkbhOhakDelMwoA/NO5LxryPgAHNThvFU9hMJJcmgxMoi7uAa6e4rB/MH8Dt82vl4RkmNmaTDqMw5PYVDXMh8dvJYYripa6LQ0ayIwH222H6B3TOcfx6OgFt6dxUq51AoF+4VByP0c3f8ygBIQWGbwKdDsZODm5u0jsww3TsMfAm+O4PG4PQKX8ozynEtyIa+pA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TuPUSpLqaK92IujUVnA7F7bH/Gr7PFU4pcMYQxkBpq0=; b=p3mZmwW6NGODPolUQ2Jes5eI7W46JHCQrE/bRE7oOyZxhShjC0Rps01avgGcEfqb7v1pzLybjEvPvzEv1wsbWgDg8w/wcovbdJEEHygibdyak4f42cm4NFqk5w11INCfUgm/4r5TYSK1C87BqubBGIhUQ6EPVbKqarN/SVBLinOtjj0e30bRIU7rjlz0S0hvSU6zEBWtx6tYm7+RtGPbP7LLd+srl2/H99wDx1WnLvb5lIRXnwNHoRZYQfHglskdP80lg9C9LzS0Wa6majK0ZAbI/pM2Al9hs3vGaKnA+30QcizsL8URGMtwgDVwt8UdkTFkvSbPK4nJGzpXli8qhA== Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) by DU0PR09MB5786.eurprd09.prod.outlook.com (2603:10a6:10:3e1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.27; Mon, 27 Feb 2023 07:32:42 +0000 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::f2af:9752:58df:ad9]) by AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::f2af:9752:58df:ad9%6]) with mapi id 15.20.6134.029; Mon, 27 Feb 2023 07:32:41 +0000 In-Reply-To: <5dea8e3b-4867-52f8-19fb-9bf5ab167f46@yandex.ru> (Dmitry Gutov's message of "Sun, 26 Feb 2023 20:03:08 +0200") X-TMN: [QXH9I3FqlV7q04gpAq4Bv+qRrxY/oy26] X-ClientProxiedBy: MM0P280CA0101.SWEP280.PROD.OUTLOOK.COM (2603:10a6:190:9::27) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <874jr7r2aw.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM9PR09MB4977:EE_|DU0PR09MB5786:EE_ X-MS-Office365-Filtering-Correlation-Id: f3212f3b-8c25-45e6-f649-08db1894cee8 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LrR0FqfcH/c8F71wltHo9yBFzI87ntB+4GGRLPiH8VadKS/+V6I8Um+9YupVXnUNsUY3Bc8SfVEQnBskGI5Rw9h8i0Wf+UqMOh0B2R8/Z4fNBVGT+2Pr+ln0oNJ1B1qSw049+gi3WaLX3v3ttOqyDdyU0kbjbdywXeYjNsHZhZXbBr/6/nfUeLrPuPWR1MSg4wz4c8StNRI48ETDe4uevI4F4uwMVQWE36W+nBVyH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ttVPlaotqKy42xOSPZSzeecKTd3aDySOEodAGQGbe4YROgXSenp/jkrqljneWmd1aRN/6dZVwMAONIk1GX8yLWqcl7L5rssyzE5NhtvWiguEaAkNPTchJ6S8LiDn9Pd1QN585q6wwQt1/39H1zHZPnf8psuXGsg65Z2+9V02yhlhSDC36d3ELJmtTWuIG4Yf77TGUJsfdZEx8Vw 5pZLqMAB48wwoBtX2KR2Ah5U7bXrqSzYUR7AYH89gU9NsM1w9of979jTdyJC/Cr6xOcuWsaAzOmenJrLNht9+NdDc5KAjo6XYC X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-64da6.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: f3212f3b-8c25-45e6-f649-08db1894cee8 X-MS-Exchange-CrossTenant-AuthSource: AM9PR09MB4977.eurprd09.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2023 07:32:41.5058 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR09MB5786 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:256851 Archived-At: Dmitry Gutov writes: > On 26/02/2023 18:23, Arthur Miller wrote: >> What actions trigger the bug: >> Two different, unrelated repositories with emacs source code tree. My tree(s) >> looks like this: >> ~/repos/emsrc/emacs/ >> ~/repos/enacs-tests/emacs/ >> Where in both the last "emacs/" is the Emacs source tree from main git >> repository. >> ~/repos/emsrc/emacs/ is the one I use for my "everyday" Emacs. I build Emacs >> now >> and then once in a week or few weeks with a script, and I make each build in its >> own our-of-source worktree. The other one is one where I used to do some tests. >> It shouldn't matter since all worktrees are contained withing parent directory, >> which in one case is "emsrc" and in the other case "emacs-tests", but for some >> reason project.el sees the wrong one. >> 1. create two parent folders each one containing a copy of emacs sources >> 1. create out of source worktree for Emacs source under one of those >> 2. navigate to the worktree/lisp/progmodes >> 3. run M-: (project-known-project-roots) >> In my Emacs, I am in my currently installed emacs worktree, where git root is >> ~/repos/emsrc/emacs but project.el returns ("~/repos/emacs-tests/emacs/") as a >> result > > What does (project-root (project-current)) return? And which dirs you are > testing it in? It returns the current worktree folder: "/home/arthur/repos/emsrc/no-gtk-with-cairo-and-native-230226-061643/" which I guess is what project.el finds as root since it only uses .git as a marker, if I understand correctly what you write little further. >> I am not chasing the bug, but I don't see much code in project.el related >> to worktrees. > > Normally, there shouldn't be any need to handle worktree specially: it contains > a file called .git at the top which can serve as a marker just fine. Well define "normally" and "just fine" :). Anyway, when I read your reply it seems like I have wrong expectation from project.el, so the fault is on my side. I thought it can deal with git projects in general, but as I understand it then, it only works with files in current directory. >> The only place I see them mentioned is about submodules.I >> personally have used this one for quite some time, and it seems to correctly >> handle worktrees for me: > > You code looks like it can return the "actual git root" that can be a directory > residing somewhere else than the current directory tree. Git worktrees can be placed outside the main repository tree: git worktree add ../my-new-shiny-emacs-patch as an example. The code will find correct git root both outside, or within the repo. But I think it should be done by actually asking git to list worktrees instead. > Is that what you > wanted? Yes that is what I wanted? :-). For automation purpose I need to find the project root, so I can pull sources to main, create a clean worktree from main, and switch Emacs to the new worktree interactively in one command, like M-x make-new-patch. Emacs asks me for a name and create a clean worktree from the main trunk for current project. Actually better variant is to ask which branch to patch, but the first one is slightly faster and works just fine in many cases.