Skip to content

Commit 3e7ad9d

Browse files
committed
ghub-{host,username}: Handle callers passing nil for FORGE or HOST
They shouldn't do that, but the current version of Forge still does.
1 parent 793459c commit 3e7ad9d

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

lisp/ghub.el

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -756,12 +756,15 @@ or (info \"(ghub)Getting Started\") for instructions."
756756
host))
757757
(if (functionp token) (funcall token) token)))
758758

759-
(cl-defmethod ghub--host (&optional (forge 'github))
760-
(or (ghub--git-get (format "%s.host" forge))
761-
(alist-get forge ghub-default-host-alist)))
762-
763-
(cl-defmethod ghub--username (host &optional (forge 'github))
764-
(let ((var (format "%s.%s.user" forge host)))
759+
(cl-defmethod ghub--host (&optional forge)
760+
(let ((forge (or forge 'github)))
761+
(or (ghub--git-get (format "%s.host" forge))
762+
(alist-get forge ghub-default-host-alist))))
763+
764+
(cl-defmethod ghub--username (host &optional forge)
765+
(let* ((forge (or forge 'github))
766+
(host (or host (ghub--host forge)))
767+
(var (format "%s.%s.user" forge host)))
765768
(or (ghub--git-get var)
766769
(if-let (((equal host (alist-get forge ghub-default-host-alist)))
767770
(default-var (format "%s.user" forge)))

0 commit comments

Comments
 (0)