Function: magit-get-submodule-name

magit-get-submodule-name is a byte-compiled function defined in magit-git.el.

Signature

(magit-get-submodule-name PATH)

Documentation

Return the name of the submodule at PATH.

PATH has to be relative to the super-repository.

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-git.el
(defun magit-get-submodule-name (path)
  "Return the name of the submodule at PATH.
PATH has to be relative to the super-repository."
  (if (magit-git-version>= "2.38.0")
      ;; "git submodule--helper name" was removed,
      ;; but might still come back in another form.
      (substring
       (car (split-string
             (car (or (magit-git-items
                       "config" "-z"
                       "-f" (expand-file-name ".gitmodules" (magit-toplevel))
                       "--get-regexp" "^submodule\\..*\\.path$"
                       (concat "^" (regexp-quote (directory-file-name path)) "$"))
                      (error "No such submodule `%s'" path)))
             "\n"))
       10 -5)
    (magit-git-string "submodule--helper" "name" path)))