summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/km-magit.el72
1 files changed, 36 insertions, 36 deletions
diff --git a/lisp/km-magit.el b/lisp/km-magit.el
index 0943fe8..3828812 100644
--- a/lisp/km-magit.el
+++ b/lisp/km-magit.el
@@ -879,42 +879,42 @@ appending [M/N] to each entry."
(setq args (seq-remove
(lambda (a) (string-match-p "\\`--base=" a))
args))
- (if-let ((current (magit-get-current-branch))
- (upstream (magit-get-upstream-branch current)))
- (let ((patch-branch (concat "patches/" current)))
- (if (not (magit-local-branch-p patch-branch))
- (magit-branch-and-checkout patch-branch current)
- (magit-update-ref (concat "refs/heads/" patch-branch)
- (concat "reset: moving back to " current)
- current)
- (magit-branch-checkout patch-branch))
- (apply #'magit-run-git "format-patch"
- upstream (concat "--base=" upstream) args)
- (let* ((patches (or (seq-filter
- (lambda (f) (string-match-p "\\.patch\\'" f))
- (magit-untracked-files))
- (error "There should be patches")))
- (cover (seq-find
- (lambda (f)
- (string-match-p
- (rx string-start
- (zero-or-one "v" (one-or-more digit) "-")
- (one-or-more "0"))
- f))
- patches)))
- (magit-call-git "add" patches)
- (magit-run-git "commit" "-mpatches")
- (when cover
- (with-temp-buffer
- (insert-file-contents cover)
- (km/magit-tweak-patch-series-summary)
- (write-region nil nil cover))
- (magit-call-git "commit" "-mtweak cover" "--" cover))
- (when cover
- (find-file-other-window cover)
- (re-search-forward (rx "Subject: [PATCH" (zero-or-more not-newline) "] "))
- (setq buffer-read-only nil))))
- (user-error "No upstream branch")))
+ (let* ((current (magit-get-current-branch))
+ (upstream (or (magit-get-upstream-branch current)
+ (user-error "No upstream branch")))
+ (patch-branch (concat "patches/" current)))
+ (if (not (magit-local-branch-p patch-branch))
+ (magit-branch-and-checkout patch-branch current)
+ (magit-update-ref (concat "refs/heads/" patch-branch)
+ (concat "reset: moving back to " current)
+ current)
+ (magit-branch-checkout patch-branch))
+ (apply #'magit-run-git "format-patch"
+ upstream (concat "--base=" upstream) args)
+ (let* ((patches (or (seq-filter
+ (lambda (f) (string-match-p "\\.patch\\'" f))
+ (magit-untracked-files))
+ (error "There should be patches")))
+ (cover (seq-find
+ (lambda (f)
+ (string-match-p
+ (rx string-start
+ (zero-or-one "v" (one-or-more digit) "-")
+ (one-or-more "0"))
+ f))
+ patches)))
+ (magit-call-git "add" patches)
+ (magit-run-git "commit" "-mpatches")
+ (when cover
+ (with-temp-buffer
+ (insert-file-contents cover)
+ (km/magit-tweak-patch-series-summary)
+ (write-region nil nil cover))
+ (magit-call-git "commit" "-mtweak cover" "--" cover))
+ (when cover
+ (find-file-other-window cover)
+ (re-search-forward (rx "Subject: [PATCH" (zero-or-more not-newline) "] "))
+ (setq buffer-read-only nil)))))
;;; Copy functions