80
80
:group 'magit-stgit
81
81
:type 'string )
82
82
83
- (defcustom magit-stgit-refresh-stage-only t
84
- " Whether a patch is refreshed only with staged changes (or the worktree otherwise)."
85
- :group 'magit-stgit
86
- :type 'boolean )
87
-
88
- (defcustom magit-stgit-refresh-ask-to-stage magit-commit-ask-to-stage
89
- " Whether to ask to stage everything when refreshing a patch and nothing is staged."
90
- :group 'magit-stgit
91
- :type 'boolean )
92
-
93
83
; ;;; Faces
94
84
95
85
(defgroup magit-stgit-faces nil
@@ -269,7 +259,7 @@ Else, asks the user for a patch name."
269
259
(?\r " Show" magit-stgit-show)
270
260
(?a " Goto" magit-stgit-goto-popup)
271
261
; ;
272
- (?g " Refresh" magit-stgit-refresh)
262
+ (?g " Refresh" magit-stgit-refresh-popup )
273
263
(?r " Repair" magit-stgit-repair)
274
264
(?R " Rebase" magit-stgit-rebase)
275
265
; ;
@@ -282,7 +272,7 @@ Else, asks the user for a patch name."
282
272
(interactive )
283
273
(magit-run-stgit " init" ))
284
274
285
- (defvar magit-stgit-new-filename-regexp " .stgit-new.txt" )
275
+ (defvar magit-stgit-new-filename-regexp " .stgit-\\ ( new\\ |edit \\ ) .txt" )
286
276
287
277
(defun magit-stgit-new-check-buffer ()
288
278
" Check if buffer is an StGit commit message."
@@ -381,24 +371,28 @@ Use ARGS to pass additional arguments."
381
371
(interactive (-flatten (list (magit-stgit-uncommit-arguments))))
382
372
(magit-run-stgit " uncommit" args))
383
373
374
+ (magit-define-popup magit-stgit-refresh-popup
375
+ " Popup console for StGit refresh."
376
+ 'magit-popups
377
+ :switches '((?u " Only update the current patch files" " --update" )
378
+ (?i " Refresh from index instead of worktree" " --index" )
379
+ (?F " Force refresh even if index is dirty" " --force" )
380
+ (?e " Edit the patch description" " --edit" )
381
+ (?s " Add \" Signed-off-by:\" line" " --sign" )
382
+ (?a " Add \" Acked-by:\" line" " --ack" ))
383
+ :actions '((?g " Refresh" magit-stgit-refresh))
384
+ :default-action #'magit-stgit-refresh )
385
+
384
386
;;;### autoload
385
- (defun magit-stgit-refresh (&optional patch )
386
- " Refresh a StGit patch."
387
- (interactive
388
- (list (magit-stgit-read-patch " Refresh patch (default top)" )))
389
- (let ((args '(" refresh" )))
390
- (when magit-stgit-refresh-stage-only
391
- (add-to-list 'args " -i" t )
392
- (unless (magit-anything-staged-p)
393
- (if magit-stgit-refresh-ask-to-stage
394
- (if (y-or-n-p " Nothing staged. Stage and refresh everything? " )
395
- (magit-run-git " add" " -u" " ." )
396
- (user-error " Nothing staged" ))
397
- (user-error " Nothing staged" ))))
398
- (when patch
399
- (add-to-list 'args " -p" t )
400
- (add-to-list 'args patch t ))
401
- (magit-run-stgit args)))
387
+ (defun magit-stgit-refresh (&optional patch &rest args )
388
+ " Refresh StGit patch PATCH.
389
+ Use ARGS to pass additional arguments."
390
+ (interactive (list (magit-stgit-read-patches nil nil t nil " Refresh patch (default top)" )
391
+ (magit-stgit-refresh-arguments)))
392
+ (setq patch (nth 0 patch))
393
+ (when patch
394
+ (add-to-list 'args (format " --patch=%s " patch) t ))
395
+ (magit-run-stgit-async " refresh" args))
402
396
403
397
;;;### autoload
404
398
(defun magit-stgit-repair ()
0 commit comments