diff options
| author | Thanos Apollo <public@thanosapollo.org> | 2026-04-24 09:43:20 +0300 |
|---|---|---|
| committer | Thanos Apollo <public@thanosapollo.org> | 2026-04-24 09:43:20 +0300 |
| commit | cc90d4082a56fedc5b8d3038d320d6b247629dec (patch) | |
| tree | 241f6ffc3af6be88eabb9aa0b4055f351009ad91 | |
| parent | a6c05aa50724e870d753d5c5d32754af0bf6b887 (diff) | |
vc: Async PR fetch to avoid blocking.
| -rw-r--r-- | lisp/forgejo-vc.el | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lisp/forgejo-vc.el b/lisp/forgejo-vc.el index 45c61ad..adb6f2a 100644 --- a/lisp/forgejo-vc.el +++ b/lisp/forgejo-vc.el @@ -345,9 +345,20 @@ Warns if manual merge is disabled for the repo." (unless enabled (message "Warning: Manual merge is disabled for %s/%s. Local merges won't be recognized by Forgejo." (nth 1 context) (nth 2 context))))) - (vc-git-command nil 0 nil "fetch" remote (format "%s:%s" ref branch)) - (vc-git-command nil 0 nil "checkout" branch) - (message "Checked out %s from %s" branch remote))) + (message "Fetching PR #%d from %s..." n remote) + (let ((dir default-directory)) + (make-process + :name (format "forgejo-fetch-pr-%d" n) + :command (list "git" "fetch" remote (format "%s:%s" ref branch)) + :sentinel + (lambda (_proc event) + (cond + ((string-match-p "finished" event) + (let ((default-directory dir)) + (vc-git-command nil 0 nil "checkout" branch)) + (message "Checked out %s from %s" branch remote)) + ((string-match-p "\\(?:exited\\|signal\\)" event) + (message "Failed to fetch PR #%d: %s" n (string-trim event))))))))) ;;;###autoload (defun forgejo-vc-update () |
