]> git.eshelyaron.com Git - emacs.git/commitdiff
vc-git-log-edit-toggle-amend: Honor vc-allow-rewriting-published-history
authorDmitry Gutov <dmitry@gutov.dev>
Sun, 27 Oct 2024 00:46:57 +0000 (03:46 +0300)
committerEshel Yaron <me@eshelyaron.com>
Tue, 29 Oct 2024 09:52:47 +0000 (10:52 +0100)
* etc/NEWS: Update the entry for
vc-allow-rewriting-published-history.

* lisp/vc/vc-git.el (vc-git-log-edit-toggle-amend):
Add a check against published history (bug#64055).

(cherry picked from commit 2030b8c7f24a10024ab973149b10194fd50dd2bb)

etc/NEWS
lisp/vc/vc-git.el

index 8526a80da5e659b19fde63b30a45a901f3f31811..9f679fc5032326c4a7532c01fc2b1e1b2273c238 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -547,13 +547,11 @@ of seconds.  Crossfading can be toggled using the command
 
 ---
 *** New user option 'vc-allow-rewriting-published-history'.
-Many VCS commands can change your copy of published change history
-without warning.  If VC commands detect that this could happen, they
-will stop.  You can customize this variable to permit rewriting history
+Some VCS commands can change your copy of published change history
+without warning.  In VC we try to detect before that happens, and stop.
+You can customize this variable to permit rewriting history
 even though Emacs thinks it is dangerous.
 
-So far, this applies only to using 'e' from Log View mode for Git.
-
 ---
 *** 'vc-clone' is now an interactive command.
 When called interactively, 'vc-clone' now prompts for the remote
index d959007c106b009e13ea9f0fa3d30ff3650a33ac..c02618d15ee28e7ece17dc63db5211ad0714455b 100644 (file)
@@ -1040,6 +1040,7 @@ See `vc-git-log-edit-summary-max-len'.")
   "Toggle whether this will amend the previous commit.
 If toggling on, also insert its message into the buffer."
   (interactive)
+  (vc-git--assert-allowed-rewrite (vc-git--rev-parse "HEAD"))
   (log-edit--toggle-amend (lambda ()
                             (vc-git-get-change-comment nil "HEAD"))))