vc-git-log-edit-toggle-amend: Honor vc-allow-rewriting-published-history

* 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).
This commit is contained in:
Dmitry Gutov 2024-10-27 03:46:57 +03:00
parent 523aade3ea
commit 2030b8c7f2
2 changed files with 4 additions and 5 deletions

View file

@ -613,13 +613,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

View 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"))))