emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/git-commit 2653432bb5: git-rebase: Support update-ref acti


From: ELPA Syncer
Subject: [nongnu] elpa/git-commit 2653432bb5: git-rebase: Support update-ref action
Date: Mon, 31 Oct 2022 22:58:49 -0400 (EDT)

branch: elpa/git-commit
commit 2653432bb51350a145f7234f2c9cb89746b26537
Author: Kyle Meyer <kyle@kyleam.com>
Commit: Kyle Meyer <kyle@kyleam.com>

    git-rebase: Support update-ref action
    
    This action is new in Git 2.38.
    
    Closes #4776.
---
 docs/RelNotes/3.4.0.org |  3 +++
 lisp/git-rebase.el      | 19 ++++++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/docs/RelNotes/3.4.0.org b/docs/RelNotes/3.4.0.org
index 4d46521c9a..42ea3fa3cd 100644
--- a/docs/RelNotes/3.4.0.org
+++ b/docs/RelNotes/3.4.0.org
@@ -145,6 +145,9 @@ dfe3d03a14 git-commit-save-message: Report whether message 
was saved
   is used by ~magit-ediff-dwim~ (the new command ~magit-git-mergetool~
   is another option).  #4348
 
+- Support ~--update-refs~ option of ~git rebase~ (new in Git 2.38).
+  #4776
+
 - Improve the diff shown while committing.  #3246
 
 [TODO Keep these at end.]
diff --git a/lisp/git-rebase.el b/lisp/git-rebase.el
index 7ac3ab6a33..fbea447cc9 100644
--- a/lisp/git-rebase.el
+++ b/lisp/git-rebase.el
@@ -166,6 +166,7 @@
     (define-key map (kbd "w")   #'git-rebase-reword)
     (define-key map (kbd "s")   #'git-rebase-squash)
     (define-key map (kbd "t")   #'git-rebase-reset)
+    (define-key map (kbd "u")   #'git-rebase-update-ref)
     (define-key map (kbd "x")   #'git-rebase-exec)
     (define-key map (kbd "y")   #'git-rebase-insert)
     (define-key map (kbd "z")   #'git-rebase-noop)
@@ -258,6 +259,7 @@ If the region is active, act on all lines touched by the 
region."
     (?r . "reword")
     (?s . "squash")
     (?t . "reset")
+    (?u . "update-ref")
     (?x . "exec"))
   "Alist mapping single key of an action to the full name.")
 
@@ -291,7 +293,8 @@ If the region is active, act on all lines touched by the 
region."
     (bare . ,(concat (regexp-opt '("b" "break" "noop") "\\(?1:")
                      " *$"))
     (label . ,(concat (regexp-opt '("l" "label"
-                                    "t" "reset")
+                                    "t" "reset"
+                                    "u" "update-ref")
                                   "\\(?1:")
                       " \\(?3:[^ \n]+\\) ?\\(?4:.*\\)"))
     (merge . ,(concat "\\(?1:m\\|merge\\) "
@@ -547,6 +550,20 @@ input, remove the reset command on the current line, if 
any."
          ""))
    arg))
 
+(defun git-rebase-update-ref (arg)
+  "Insert an update-ref action after the current line.
+If there is already an update-ref action on the current line,
+then edit that instead.  With a prefix argument, insert a new
+action even when there is already one on the current line.  With
+empty input, remove the action on the current line, if any."
+  (interactive "P")
+  (git-rebase-set-noncommit-action
+   "update-ref"
+   (lambda (initial)
+     (or (magit-completing-read "Ref" (magit-list-refs) nil nil initial)
+         ""))
+   arg))
+
 (defun git-rebase-merge (arg)
   "Add a merge command after the current commit.
 If there is already a merge command on the current line, then



reply via email to

[Prev in Thread] Current Thread [Next in Thread]