git - 在一个项目中具有多个 repos(git/svn 等)的 Emacs 射弹

标签 git emacs emacs-projectile

我有一个 git 仓库,其目录结构如下所示:

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

root 是我的工作目录,3rd 由多个第三方 git 子模块组成。
projectile-find-file 只能在 src 中找到文件,它对子模块不起作用。

最佳答案

projectile-git-command 使用git ls-files 列出属于项目的文件,
所以我用下面的代码解决了这个问题:

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

git-ls-all-files 是一个 shell 脚本:

\#!/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

关于git - 在一个项目中具有多个 repos(git/svn 等)的 Emacs 射弹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23211136/

相关文章:

python - 检查我的提交在 emacs/git 中是否有 'import pdb'?

emacs - Emacs Cider Repl 缓冲区内的长输出

emacs projectile - 在没有 git、hg 等存储库的情况下初始化项目缓存

emacs - 为什么 Emacs 项目 C-c p 未定义?

git - git 添加后存储库中缺少文件夹

git - Visual Studio 和 libgit2 Git Commit Error In different 解决方案

git - 如果文件已经在服务器上,避免 git-ftp 上传

emacs - org-mode 不能编辑 C 源代码

emacs - 如何使用projectile-find-test-file

javascript - 克隆后选择元素不起作用