guoxx
guoxx

Reputation: 368

Emacs projectile with multiple repos (git/svn etc.) in one project

I have a single git repo with a directory structure that looks like this:

root ---------- src
        |
        |
        |------ 3rd

root is my working directory, 3rd consists of multiple third-party git submodules.
projectile-find-file only finds files in src, it does not work for the submodules.

Upvotes: 10

Views: 2622

Answers (3)

Trung Ta
Trung Ta

Reputation: 1732

In addition to the solution of Mike, I add a .projectile file to each submodule and this submodule will become a new project in Emacs.

Upvotes: 0

Mike H-R
Mike H-R

Reputation: 7835

I just had an equivalent problem, I fixed it by adding an empty .projectile file to my root directory, this tells projectile that that directory is the real project root and to search all the files in it's subdirectories when you want to find something.

See here for more info.

Upvotes: 7

guoxx
guoxx

Reputation: 368

projectile-git-command uses git ls-files to list the files belonging to the project,
so I resolved the problem with the following code:

(setq projectile-git-command "git-ls-all-files")

git-ls-all-files is a shell script:

\#!/bin/zsh
files=`git ls-files -co --exclude-standard`
sb_files=`git --no-pager submodule --quiet foreach 'git ls-files --full-name -co --exclude-standard | sed s!^!$path/!'`
all_files=$files$sb_files

echo $all_files

Upvotes: 7

Related Questions