projectile icon indicating copy to clipboard operation
projectile copied to clipboard

projectile-mode doesn't recognize subproject when .projectile file exist in parent project

Open dadinn opened this issue 3 years ago • 2 comments

Expected behavior

I have a parent git project called .emacs.d which has the following directory structure

.emacs.d
  |- .projectile
  |- init.el
  |- straight
     |- repos
        |- projectile
           |- projectile.el
           |- README.md

The .projectile file can be empty. The straight/repos/projectile directory is another git repo (this one actually), cloned by straight.el. Let's suppose that I have opened ./straight/projectile/projectile.el file, and then I try to use projectile-find-file command to find any other file in the projectile repo. I should be able to do this and see files listed from the projectile git repository (e.g. README.md), and not other files from the parent .emacs.d repo (e.g. init.el).

Actual behavior

projectile-find-file shows the files from the .emacs.d repo, and not from the projectile repo instead. Once I remove the offending .projectile file from the parent .emacs.d folder, I am able to list only the files inside the projectile repository instead.

Steps to reproduce the problem

  • Configure straight.el and install projectile repo.
  • Create a .projectile file in the .emacs.d directory,
  • open ./straight/repos/projectile/projectile.el file.
  • press C-c p f to call projectile-find-file

Environment & Version information

Projectile version information

2.5.0

Emacs version

27.1

Operating system

Debian 11

dadinn avatar Dec 05 '21 12:12 dadinn

This bug is really annoying,

For example I have:

dev/linux -- my personal git repo for managing linux dev
dev/linux/src -- kernel code git repo
dev/linux/src2 -- user space tool git repo

When I open both src and src2 it thinks I only have dev/linux project open, and things like project wide searches are for all 3 directories, and not just the kernel code or user space code, this makes it confusing because some files are duplicates in both kernel and user space, and then it's also unnecessarily slow search.

There's also a problem with make running in dev/linux/src2/linux when I run compilation SPC c c (doom emacs) and I suspect it might be related.

YellowOnion avatar May 12 '22 04:05 YellowOnion

Seems related to https://github.com/bbatsov/projectile/issues/1130. I'll take a closer look when I can, but everyone's welcome to beat me to it.

bbatsov avatar May 12 '22 05:05 bbatsov