Skip to content

Commit fcb9a7a

Browse files
committed
Convert refresh popup
Require a match when prompting for a patch.
1 parent 28f7f1a commit fcb9a7a

File tree

1 file changed

+25
-22
lines changed

1 file changed

+25
-22
lines changed

magit-stgit.el

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ one from the minibuffer, and move to the next line."
267267
("Z" "Redo" magit-stgit-redo-popup)]]
268268
["Patch"
269269
[("N" "New" magit-stgit-new)
270-
("g" "Refresh" magit-stgit-refresh-popup)
270+
("g" "Refresh" magit-stgit-refresh)
271271
("RET" "Show" magit-stgit-show)]
272272
[("e" "Edit" magit-stgit-edit)
273273
("n" "Rename" magit-stgit-rename)
@@ -438,28 +438,31 @@ one from the minibuffer."
438438
(interactive (transient-args 'magit-stgit-uncommit))
439439
(magit-run-stgit "uncommit" args))
440440

441-
(magit-define-popup magit-stgit-refresh-popup
442-
"Popup console for StGit refresh."
443-
'magit-stgit-commands
444-
:switches '((?u "Only update the current patch files" "--update")
445-
(?i "Refresh from index instead of worktree" "--index")
446-
(?F "Force refresh even if index is dirty" "--force")
447-
(?e "Edit the patch description" "--edit")
448-
(?s "Add \"Signed-off-by:\" line" "--sign")
449-
(?a "Add \"Acked-by:\" line" "--ack"))
450-
:actions '((?g "Refresh" magit-stgit-refresh))
451-
:default-action #'magit-stgit-refresh)
441+
(transient-define-prefix magit-stgit-refresh ()
442+
"Include the latest changes into a patch."
443+
:man-page "stg-refresh"
444+
["Arguments"
445+
("-u" "Only update the current patch files" "--update")
446+
("-i" "Refresh from index instead of worktree" "--index")
447+
("-F" "Force refresh even if index is dirty" "--force")
448+
("-e" "Edit the patch description" "--edit")
449+
("-s" "Add Signed-off-by" "--sign")
450+
("-a" "Add Acked-by" "--ack")]
451+
["Actions"
452+
("g" "Refresh" magit-stgit--refresh)])
452453

453454
;;;###autoload
454-
(defun magit-stgit-refresh (&optional patch &rest args)
455-
"Refresh StGit patch PATCH.
456-
Use ARGS to pass additional arguments."
457-
(interactive (list (magit-stgit-read-patches nil nil t nil "Refresh patch (default top)")
458-
(magit-stgit-refresh-arguments)))
459-
(setq patch (nth 0 patch))
460-
(when patch
461-
(setq args (append args (list (format "--patch=%s" patch)))))
462-
(magit-run-stgit-async "refresh" args))
455+
(defun magit-stgit--refresh (&optional patch &rest args)
456+
"Invoke `stg refresh --patch PATCH ARGS...'.
457+
458+
If PATCH is nil, refresh the current patch.
459+
460+
If called interactively, refresh the patch at point or read one
461+
from the minibuffer."
462+
(interactive (cons (car (magit-stgit-read-patches
463+
nil nil t t "Refresh patch"))
464+
(transient-args 'magit-stgit-refresh)))
465+
(magit-run-stgit-async "refresh" (and patch (list "--patch" patch)) args))
463466

464467
;;;###autoload
465468
(defun magit-stgit-repair ()
@@ -694,7 +697,7 @@ the To, Cc, and Bcc fields for all patches."
694697
["Sink patch" magit-stgit-sink
695698
:help "Sink StGit patch deeper down the stack"]
696699
"---"
697-
["Refresh patch" magit-stgit-refresh-popup
700+
["Refresh patch" magit-stgit-refresh
698701
:help "Refresh the contents of a patch in an StGit series"]
699702
["Repair" magit-stgit-repair
700703
:help "Repair StGit metadata if branch was modified with git commands"]

0 commit comments

Comments
 (0)