From 1669fdcb02ec86379aeae5a4ff5cfa548a39ffe8 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Sun, 23 May 2021 17:21:50 -0400 Subject: km/magit-patch-create-series: Allow base override I sometimes want to use an outdated base. --- lisp/km-magit.el | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lisp/km-magit.el b/lisp/km-magit.el index f6f4cdf..bd14dcb 100644 --- a/lisp/km-magit.el +++ b/lisp/km-magit.el @@ -881,9 +881,6 @@ appending [M/N] to each entry." ;; specified. (when (magit-anything-modified-p t) (user-error "There are uncommitted changes")) - (setq args (seq-remove - (lambda (a) (string-match-p "\\`--base=" a)) - args)) (let* ((current (magit-get-current-branch)) (upstream (or (magit-get-upstream-branch current) (user-error "No upstream branch"))) @@ -894,8 +891,10 @@ appending [M/N] to each entry." (concat "reset: moving back to " current) current) (magit-branch-checkout patch-branch)) - (apply #'magit-run-git "format-patch" - upstream (concat "--base=" upstream) args) + (unless (seq-some (lambda (a) (string-match-p "\\`--base=" a)) + args) + (setq args (cons (concat "--base=" upstream) args))) + (apply #'magit-run-git "format-patch" upstream args) (let* ((patches (or (seq-filter (lambda (f) (string-suffix-p ".patch" f)) (magit-untracked-files)) -- cgit v1.2.3