diff options
author | Kyle Meyer <kyle@kyleam.com> | 2020-11-18 00:16:12 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2020-11-18 00:18:16 -0500 |
commit | 3c631ee3315344d77e4f64c13c32d5b43f381c38 (patch) | |
tree | bd7a3207e4e8c9633f2aaea78539319a8b8b32c6 /lisp | |
parent | dbabbc179cbc6faf82d431ceb6697cce21a06310 (diff) | |
download | emacs.d-3c631ee3315344d77e4f64c13c32d5b43f381c38.tar.gz |
km/magit-patch-create-series: Move an error closer to its origin
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/km-magit.el | 72 |
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 |