Skip to content

Commit 8beace1

Browse files
committed
forge--pullreq-range: New function
Prefer the remote-tracking branch as that is more likely to be up-to-date. The `endpoints' argument is for when the range is to be used to show a diff. From git-diff(1): > "diff" is about comparing two endpoints, not ranges, and the range > notations ("<commit>..<commit>" and "<commit>...<commit>") do not > mean a range as defined in the "SPECIFYING RANGES" section in > gitrevisions(7).
1 parent 6f299d2 commit 8beace1

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

lisp/forge-pullreq.el

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,12 @@ yourself, in which case you probably should not reset either.
199199
(let ((ref (format "refs/pullreqs/%s" (oref pullreq number))))
200200
(and (magit-rev-verify ref) ref)))
201201

202+
(defun forge--pullreq-range (pullreq &optional endpoints)
203+
(when-let ((head (forge--pullreq-ref pullreq)))
204+
(concat (forge--get-remote) "/" (oref pullreq base-ref)
205+
(if endpoints "..." "..")
206+
head)))
207+
202208
(cl-defmethod forge-get-url ((pullreq forge-pullreq))
203209
(forge--format pullreq 'pullreq-url-format))
204210

@@ -245,11 +251,10 @@ Also see option `forge-topic-list-limit'."
245251
(forge--topic-type-prefix repo 'pullreq)))))
246252

247253
(defun forge--insert-pullreq-commits (pullreq)
248-
(when-let ((ref (forge--pullreq-ref pullreq)))
254+
(when-let ((range (forge--pullreq-range pullreq)))
249255
(magit-insert-section-body
250256
(cl-letf (((symbol-function #'magit-cancel-section) (lambda ())))
251-
(magit-insert-log (format "%s..%s" (oref pullreq base-ref) ref)
252-
magit-buffer-log-args)
257+
(magit-insert-log range magit-buffer-log-args)
253258
(magit-make-margin-overlay nil t)))))
254259

255260
(cl-defmethod forge--insert-topic-contents :after ((pullreq forge-pullreq)

0 commit comments

Comments
 (0)