summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <public@thanosapollo.org>2026-04-28 17:59:45 +0300
committerThanos Apollo <public@thanosapollo.org>2026-04-28 17:59:45 +0300
commitdca75f1e13130d548692135cf159c0e18f7b68fb (patch)
treea7b0d0c1313cda245fdaf7bc803a8bab5d5d9104
parentdf52e4d8ccf465667080fd53cecb01d0f4f7c033 (diff)
vc: do not use branch as default topic.
-rw-r--r--lisp/forgejo-vc.el17
1 files changed, 12 insertions, 5 deletions
diff --git a/lisp/forgejo-vc.el b/lisp/forgejo-vc.el
index 5d76dd7..02c3f1d 100644
--- a/lisp/forgejo-vc.el
+++ b/lisp/forgejo-vc.el
@@ -337,11 +337,18 @@ With prefix arg FORCE-PUSH-P, force-push to update an existing PR."
(target (if (string-match "\\`\\([^/]+\\)/\\(.+\\)\\'" choice)
(match-string 2 choice)
choice)))
- (list remote
- (let ((input (read-string (format "Topic (default: %s): " branch))))
- (if (string-empty-p input) branch input))
- target
- current-prefix-arg)))
+ (let* ((pr-branch-p (string-match-p "\\`pr-[0-9]+\\'" branch))
+ (default-topic (unless pr-branch-p branch)))
+ (list remote
+ (if default-topic
+ (let ((input (read-string (format "Topic (default: %s): " default-topic))))
+ (if (string-empty-p input) default-topic input))
+ (let ((input (read-string "Topic: ")))
+ (when (string-empty-p input)
+ (user-error "Topic is required for pr-N branches"))
+ input))
+ target
+ current-prefix-arg))))
(let ((target (replace-regexp-in-string "\\`.+/" "" target)))
(if force-push-p
(forgejo-vc--git-push