Skip to content

Commit b2ce5de

Browse files
committed
Look up username as documented
According to the documentation "FORGE.WEBHOST.user" is used, but in actuality one still had to use "FORGE.APIHOST.user". Now the former can be used and the latter is still supported for backward compatibility. Even though we treat the WEBHOST as the host ID, we don't actually store that in repository objects, so we have to use `forge-alist' to translate. Closes #796.
1 parent 4ed3809 commit b2ce5de

4 files changed

Lines changed: 9 additions & 4 deletions

File tree

CHANGELOG

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
- Fixed a pagination bug, which could completely prevent pulling API
55
data for certain Github repositories. #843
66

7+
- Fixed username lookup to work as documented. #796
8+
79
* v0.6.4 2026-04-08
810

911
- Improved the fallback default when reading the target branch for

lisp/forge-github.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1266,7 +1266,7 @@
12661266
(cl-defmethod forge--fork-repository ((repo forge-github-repository) fork all)
12671267
(with-slots (name apihost) repo
12681268
(forge-rest repo "POST" "/repos/:owner/:name/forks"
1269-
((and (not (equal fork (ghub--username apihost)))
1269+
((and (not (equal fork (ghub--username repo)))
12701270
(organization fork))
12711271
(default-branch-only (not all))))
12721272
(ghub-wait (format "/repos/%s/%s" fork name)

lisp/forge-gitlab.el

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@
600600
(cl-defmethod forge--fork-repository ((repo forge-gitlab-repository) fork _all)
601601
(with-slots (name apihost) repo
602602
(forge--glab-post repo "/projects/:project/fork"
603-
(and (not (equal fork (ghub--username apihost 'gitlab)))
603+
(and (not (equal fork (ghub--username repo)))
604604
`((namespace . ,fork)))
605605
:noerror t)
606606
(ghub-wait (format "/projects/%s%%2F%s" (string-replace "/" "%2F" fork) name)

lisp/forge-repo.el

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,8 +518,11 @@ forges and hosts."
518518
(unless (forge-repository-equal (forge-get-repository :stub?) repo)
519519
(when-let ((worktree (forge-get-worktree repo)))
520520
(setq default-directory worktree)))
521-
(cl-call-next-method (oref repo apihost)
522-
(forge--ghub-type-symbol (eieio-object-class repo)))))
521+
(with-slots (apihost) repo
522+
(cl-call-next-method
523+
(caddr (car (cl-member apihost forge-alist :test #'equal :key #'cadr)))
524+
(forge--ghub-type-symbol (eieio-object-class repo))
525+
apihost))))
523526

524527
(defun forge--ghub-type-symbol (class)
525528
(pcase-exhaustive class

0 commit comments

Comments
 (0)