Function: projectile--git-config-remote-url
projectile--git-config-remote-url is a byte-compiled function defined
in projectile.el.
Signature
(projectile--git-config-remote-url CONFIG-FILE)
Documentation
Return the URL of the upstream remote configured in CONFIG-FILE, or nil.
That's origin when it's there, since it's what cloning sets up and what
two checkouts of one repository will therefore agree on; a repository
wired up by hand may use another name, so fall back to whichever remote
comes first rather than giving up.
Source Code
;; Defined in ~/.emacs.d/elpa/projectile-20260820.1509/projectile.el
(defun projectile--git-config-remote-url (config-file)
"Return the URL of the upstream remote configured in CONFIG-FILE, or nil.
That's `origin' when it's there, since it's what cloning sets up and what
two checkouts of one repository will therefore agree on; a repository
wired up by hand may use another name, so fall back to whichever remote
comes first rather than giving up."
(when (file-readable-p config-file)
(with-temp-buffer
(insert-file-contents config-file)
(goto-char (point-min))
(let (remotes)
(while (re-search-forward "^[ \t]*\\[remote[ \t]+\"\\([^\"]+\\)\"\\]" nil t)
(let ((name (match-string 1))
(section-end (save-excursion
(if (re-search-forward "^[ \t]*\\[" nil t)
(match-beginning 0)
(point-max)))))
(when (re-search-forward "^[ \t]*url[ \t]*=[ \t]*\\(.+?\\)[ \t]*$"
section-end t)
(push (cons name (match-string 1)) remotes))))
(setq remotes (nreverse remotes))
(or (cdr (assoc "origin" remotes)) (cdar remotes))))))