Add Forge diff-for-pr function for pull request creation

This commit adds a new function forge-diff-for-pr to generate a Git diff for use in pull request creation. The function is called automatically when creating a pull request using Forge, providing an easy way to view changes between the source and target branches.
This commit is contained in:
Jeremy Dormitzer 2024-07-16 14:24:30 -04:00
parent 3537134c23
commit 9360580a94

View File

@ -70,6 +70,12 @@
(advice-add 'forge-topic-at-point :around
(lambda (oldfn &rest args)
(ignore-errors (apply oldfn args))))
(defun forge-diff-for-pr ()
(interactive)
(let ((target forge--buffer-base-branch)
(source forge--buffer-head-branch))
(magit-diff-range (format "%s..%s" source target))))
(add-hook 'forge-create-pullreq-hook #'forge-diff-for-pr)
:custom
(forge-owned-accounts '((jdormit . (remote-name "jdormit"))))
:general