From: Dmitry Gutov Date: Sun, 27 Oct 2024 00:46:57 +0000 (+0300) Subject: vc-git-log-edit-toggle-amend: Honor vc-allow-rewriting-published-history X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f349c5d399951b849aa4eb0f0e00e14e580ecb89;p=emacs.git 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). (cherry picked from commit 2030b8c7f24a10024ab973149b10194fd50dd2bb) --- diff --git a/etc/NEWS b/etc/NEWS index 8526a80da5e..9f679fc5032 100644 --- 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 diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index d959007c106..c02618d15ee 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -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"))))