GNU bug report logs -
#61817
30.0.50; Project.el finds incorrect project roots in git worktrees
Previous Next
Reported by: Arthur Miller <arthur.miller <at> live.com>
Date: Sun, 26 Feb 2023 16:29:02 UTC
Severity: normal
Found in version 30.0.50
Done: Dmitry Gutov <dgutov <at> yandex.ru>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
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.
This bug report was last modified 2 years and 142 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.