Function: projectile--git-submodule-paths

projectile--git-submodule-paths is a byte-compiled function defined in projectile.el.

Signature

(projectile--git-submodule-paths GITMODULES-DIR)

Documentation

List the populated submodule paths of the Git repo at GITMODULES-DIR.

Reads .gitmodules with git config run via process-file - no shell is involved, so the listing works regardless of the local shell (the old shell-out relied on Unix single quotes and tr, which broke on Windows - see issue #1600) and still goes through TRAMP for remote projects. Submodules that are registered but not checked out (no
.git in their directory) are omitted, matching what git submodule
foreach used to report. The returned paths are relative to GITMODULES-DIR.

Source Code

;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile--git-submodule-paths (gitmodules-dir)
  "List the populated submodule paths of the Git repo at GITMODULES-DIR.
Reads `.gitmodules' with `git config' run via `process-file' - no shell
is involved, so the listing works regardless of the local shell (the
old shell-out relied on Unix single quotes and `tr', which broke on
Windows - see issue #1600) and still goes through TRAMP for remote
projects.  Submodules that are registered but not checked out (no
`.git' in their directory) are omitted, matching what `git submodule
foreach' used to report.  The returned paths are relative to
GITMODULES-DIR."
  (let ((default-directory gitmodules-dir)
        paths)
    (with-temp-buffer
      (process-file "git" nil '(t nil) nil
                    "config" "-z" "--file" ".gitmodules"
                    "--get-regexp" "\\.path$")
      ;; Each NUL-separated record is "submodule.<name>.path\n<value>";
      ;; git has already unquoted the value for us.
      (dolist (record (split-string (buffer-string) "\0" t))
        (when-let* ((separator (string-search "\n" record)))
          (let ((path (substring record (1+ separator))))
            (when (file-exists-p
                   (expand-file-name ".git"
                                     (expand-file-name path gitmodules-dir)))
              (push path paths))))))
    (nreverse paths)))