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#61817: 30.0.50; Project.el finds incorrect project roots in git worktrees Date: Sun, 26 Feb 2023 20:03:08 +0200 Message-ID: <5dea8e3b-4867-52f8-19fb-9bf5ab167f46@yandex.ru> References: 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="14281"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 To: Arthur Miller , 61817@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 26 19:04:13 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 1pWLNd-0003bL-K3 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 26 Feb 2023 19:04:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pWLNV-00068j-0q; Sun, 26 Feb 2023 13:04:05 -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 1pWLNT-00068Y-Mk for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2023 13:04:03 -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 1pWLNT-0005E7-Ea for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2023 13:04:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pWLNS-0007Kq-Ae for bug-gnu-emacs@gnu.org; Sun, 26 Feb 2023 13:04:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 26 Feb 2023 18:04: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.167743460028147 (code B ref 61817); Sun, 26 Feb 2023 18:04:02 +0000 Original-Received: (at 61817) by debbugs.gnu.org; 26 Feb 2023 18:03:20 +0000 Original-Received: from localhost ([127.0.0.1]:45055 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWLMm-0007Jv-Fm for submit@debbugs.gnu.org; Sun, 26 Feb 2023 13:03:20 -0500 Original-Received: from mail-wr1-f42.google.com ([209.85.221.42]:36420) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pWLMi-0007Jf-IR for 61817@debbugs.gnu.org; Sun, 26 Feb 2023 13:03:19 -0500 Original-Received: by mail-wr1-f42.google.com with SMTP id l25so4021910wrb.3 for <61817@debbugs.gnu.org>; Sun, 26 Feb 2023 10:03:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:from:to:cc:subject:date:message-id:reply-to; bh=SLIbtDZwja3PlJYRFYpG2r1ATl4dUrBLJrrp3eWWPP0=; b=U4vQtb5mkk7bLn6LEuy2uNvFjDjCyWApZCoUH1/KGX1ezSVDnFc07OEpPjFWv8JEtG wTZYr4IUpg/abNB4SIuXFBzrOFVvmttCP+W1z5pbhinJK+5kTZDE7m/dO4crlHbvMA7u HV9g/CYX+oTWnuG/X0cJvTX0gGCZB8GLDZ39eFdCTz1DGnWPsY4ggTNt04E5lnuruOAA YUi2Y83a/d1VqXOHsEuH5W1FZN6eWWj3rs1ssjpcp2jHbTne1edfMZFvnLAnMDpAHyRN ugGQ3wRTxTv1KWXp5cxPH5AW/0bLcEeCbwSeDIHqWDQraz4e1lZgp/dy8kDT+9776hJN sa4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :sender:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=SLIbtDZwja3PlJYRFYpG2r1ATl4dUrBLJrrp3eWWPP0=; b=xUcm0G6bnhe2kw/gaipqamaMhHWi+6WB15J8n/sulP6b61ChNGzfDpud/kuqa/yGYU m/JzN8iTbbfWlEjqF8eYkq9MBcsQGDDtpB0VJR34XkcP9Q704xP6QeE1eQ3Qoz0nAbi2 DkbOtZVf1q+84DcJbkiSqTIXCrLSu+9S3XTMug6bhMqR6CPP1XPI4VWXU/pNn76gNkOS 7VbgFnJDghGxo/ILX2RLVC4OhrYXv0dcDXovXqhRFk6tFDCB38xF2/Vmhr5796H49kAl iAuDjnPiaVnnQ/ltguto19XxBgZZToiVX72RQ9tKGolEMMulFvPKXdbm1331s5Op7GDU oyyQ== X-Gm-Message-State: AO0yUKUieaBowuImY18gxH9WBJgC7qNODh7F7TbwvXe07n/W2rMcV99W rXvWXF3D6O9JICJuTCR9FcU= X-Google-Smtp-Source: AK7set9Xcz7hP5qXb2QuAKbOpYRwommRoKudh35bsLX6Ahxg22Ou/HdYf6PtO8/nLOuDhZL0J5j//g== X-Received: by 2002:adf:f441:0:b0:2ca:ab68:eff3 with SMTP id f1-20020adff441000000b002caab68eff3mr1970215wrp.67.1677434590502; Sun, 26 Feb 2023 10:03:10 -0800 (PST) Original-Received: from [192.168.0.2] ([46.251.119.176]) by smtp.googlemail.com with ESMTPSA id x16-20020a5d54d0000000b002c71703876bsm4923397wrv.14.2023.02.26.10.03.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 26 Feb 2023 10:03:09 -0800 (PST) Content-Language: en-US In-Reply-To: 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:256827 Archived-At: 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? > 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. > 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. Is that what you wanted? Off the top of my head, that should break the 'project-files' method.