Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

projectile-get-immediate-sub-projects won't work with non-root argument #1520

Closed
milouse opened this issue Apr 24, 2020 · 4 comments
Closed

Comments

@milouse
Copy link

milouse commented Apr 24, 2020

This issue is a copy of #1369 as I cannot re-open it. See the Discussion section to know more why I want to reopen it.

Expected behavior

(projectile-get-immediate-sub-projects "/project/a-sub-dir/")

should return a list of /project's sub-modules that are also within a-sub-dir/, nil if none.

Actual behavior

Returns non-existing paths, where each sub-module path is appended to /a-sub-dir.

Steps to reproduce the problem

  1. Create a new git project in /project
  2. Add a git-submodule "foo" to the project under /project/lib/foo
  3. Add a folder to the project under /project/a-sub-dir
  4. Execute the code above

You get ("/project/a-sub-dir/lib/foo") which is a non-existing path. Instead, you wanted nil because there is no submodule below /project/a-sub-dir.

Environment & Version information

Projectile version information

Projectile 20200329.1908

Emacs version

GNU Emacs 26.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.10) of 2019-08-29

Operating system

Archlinux

Discussion

There is already a MR to fix this problem: #1370. However, @bbatsov seems to reject it because

this command is generally supposed to be invoked in the root of a project, so I'm not certain if we'd be fixing a bug here.

But this command may be called from a non-root directory through usage of projectile-dir-files and projectile-dir-files-alien. Does it mean that these two commands must be used only from the project root directory?

The current behavior breaks projectile-rails (see asok/projectile-rails#132) for exemple. As the proposed fix is of very little impact, I would like to consider it again. Or at least ask to precise comment of projectile-dir-files to say it only works from the project root directory.

@stale
Copy link

stale bot commented Oct 22, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!

@stale stale bot added the Stale label Oct 22, 2020
@milouse
Copy link
Author

milouse commented Oct 22, 2020

… without any other argument, I imagine we’ll have to add-advice around this method in project using it…

@stale stale bot removed the Stale label Oct 22, 2020
@bbatsov bbatsov added the Bug label Dec 2, 2020
@stale
Copy link

stale bot commented Jun 2, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!

@stale stale bot added the Stale label Jun 2, 2021
@stale
Copy link

stale bot commented Sep 6, 2021

This issues been automatically closed due to lack of activity. Feel free to re-open it if you ever come back to it.

@stale stale bot closed this as completed Sep 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants