diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2022-11-15 09:12:22 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2022-11-15 09:16:34 -0700 |
commit | 93790a8c317bb5e17af5caa81148d0e30e82ffa7 (patch) | |
tree | 7240f0a082f3064f721ac8e2f4b40e30f04cf966 /.emacs.d | |
parent | 799b3f2c4385cf89af09942a53d69658f2baf4a9 (diff) | |
download | dotfiles-93790a8c317bb5e17af5caa81148d0e30e82ffa7.tar.gz |
spw/log-view-git-fixup: implement instant fixups
Diffstat (limited to '.emacs.d')
-rw-r--r-- | .emacs.d/init.el | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/.emacs.d/init.el b/.emacs.d/init.el index 7ecd2e03..7d8742fe 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -3626,14 +3626,15 @@ mutt's review view, after exiting EDITOR." (interactive) (spw/log-view-eshell-git-range "cherry-pick")) -(defun spw/log-view-git-fixup () - (interactive) +(defun spw/log-view-git-fixup (&optional instant) + (interactive "P") (let ((project-root (project-root (project-current))) (summary (format "Summary: fixup! %s\n\n" (cadr (process-lines - "git" "rev-list" "--format=%s" (log-view-current-tag)))))) + "git" "rev-list" "--format=%s" (log-view-current-tag))))) + (previous (format "%s~1" (log-view-current-tag)))) (if (and (get-buffer "*vc-log*") (with-current-buffer "*vc-log*" (file-equal-p project-root (project-root (project-current))))) @@ -3641,6 +3642,11 @@ mutt's review view, after exiting EDITOR." (erase-buffer) (insert summary) (call-interactively #'log-edit-done) + (when instant + (let ((process-environment + (cons "EDITOR=true" process-environment))) + (call-process "git" nil "*log-view-instant-fixup*" nil + "rebase" "-i" "--autosquash" previous))) (when (derived-mode-p 'vc-git-log-view-mode) (revert-buffer))) (require 'log-edit) |