Skip to content

Commit

Permalink
forge-current-repository: Remove demand argument again
Browse files Browse the repository at this point in the history
This argument was added in [1: 186e800], but isn't actually useful
for any of the current callers.  This restores `forge-pull's ability
to pull a repository that isn't in the database yet or which is still
sparse.

1: 2023-09-21 186e800
   Improve forge-*-at-point and forge-current-* functions
  • Loading branch information
tarsius committed Dec 9, 2023
1 parent cdb34cb commit a094271
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
7 changes: 4 additions & 3 deletions lisp/forge-commands.el
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,13 @@ If pulling is too slow, then also consider setting the Git variable
(interactive
(list nil
(and current-prefix-arg
(not (forge-current-repository 'full))
(let ((repo (forge-current-repository)))
(or (not repo) (oref repo sparse-p)))
(forge-read-date "Limit pulling to topics updates since: "))
t))
(let (create)
(unless repo
(setq repo (forge-current-repository 'full))
(when (or (not repo) (oref repo sparse-p))
(setq repo (forge-current-repository))
(unless repo
(setq repo (forge-get-repository 'create))
(setq create t)))
Expand Down
2 changes: 1 addition & 1 deletion lisp/forge-list.el
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ Must be set before `forge-list' is loaded.")
(interactive)
(catch 'add-instead
(unless (derived-mode-p 'forge-topic-list-mode)
(let ((repo (forge-current-repository nil)))
(let ((repo (forge-current-repository)))
(cond
((or (not repo) (not (oref repo sparse-p))))
((yes-or-no-p
Expand Down
9 changes: 3 additions & 6 deletions lisp/forge-repo.el
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,10 @@ See `forge-alist' for valid Git hosts."

;;;; Current

(defun forge-current-repository (&optional demand)
"Return the repository at point or being visited.
If there is no such repository and DEMAND is non-nil, then signal
an error."
(defun forge-current-repository ()
"Return the repository at point or being visited."
(or (forge-repository-at-point)
(forge-get-repository nil)
(and demand (user-error "No current repository"))))
(forge-get-repository nil)))

(defun forge-repository-at-point (&optional demand)
"Return the repository at point.
Expand Down

0 comments on commit a094271

Please sign in to comment.