Skip to content

Commit 393ce12

Browse files
author
Lluís Vilanova
committed
magit-stgit-delete: Do not ask about spilling if patches are empty
1 parent 84e87f2 commit 393ce12

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

magit-stgit.el

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
;;; Code:
5656

5757
(require 'cl-lib)
58+
(require 'dash)
5859

5960
(require 'magit)
6061

@@ -463,10 +464,14 @@ Argument PATCHES is a list of patchnames.
463464
Use ARGS to pass additional arguments."
464465
(interactive (list (magit-stgit-read-patches t t t t "Delete patch")
465466
(magit-stgit-delete-arguments)))
466-
(when (and (called-interactively-p 'any)
467-
(not magit-current-popup)
468-
(y-or-n-p "Spill contents? "))
469-
(add-to-list 'args "--spill"))
467+
(let ((affected-files
468+
(-mapcat (lambda (patch)
469+
(magit-stgit-lines "files" "--bare" patch))
470+
patches)))
471+
(when (and (called-interactively-p 'any)
472+
(not magit-current-popup)
473+
(and affected-files (y-or-n-p "Spill contents? ")))
474+
(add-to-list 'args "--spill")))
470475
(let ((spill (member "--spill" args)))
471476
(when spill
472477
(setq spill (list "--spill")))

0 commit comments

Comments
 (0)