From: Sean Whitton Date: Thu, 24 Oct 2024 03:26:27 +0000 (+0800) Subject: vc-allow-rewriting-published-history: Use nil->ask->t X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=291e6402df29e5db915d3a9237aec748a9f882b5;p=emacs.git vc-allow-rewriting-published-history: Use nil->ask->t * lisp/vc/vc.el (vc-allow-rewriting-published-history): Use increasingly permissive values nil->ask->t rather than nil->t->no-ask. Recommend `ask' or nil. * lisp/vc/vc-git.el (vc-git--assert-allowed-rewrite): Update accordingly. (cherry picked from commit 3bb1b85b78b8079e160dcb10774fe82c2daa1b4d) --- diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 899358339f3..f2dc584bba9 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el @@ -1966,7 +1966,8 @@ This requires git 1.8.4 or later, for the \"-L\" option of \"git log\"." "log" "--max-count=1" "--pretty=format:%B" rev))) (defun vc-git--assert-allowed-rewrite (rev) - (when (and (not (eq vc-allow-rewriting-published-history 'no-ask)) + (when (and (not (and vc-allow-rewriting-published-history + (not (eq vc-allow-rewriting-published-history 'ask)))) ;; Check there is an upstream. (with-temp-buffer (vc-git--out-ok "config" "--get" @@ -1978,7 +1979,7 @@ This requires git 1.8.4 or later, for the \"-L\" option of \"git log\"." "--pretty=format:%H" "@{upstream}..HEAD"))))) (unless (or (cl-member rev outgoing :test #'string-prefix-p) - (and vc-allow-rewriting-published-history + (and (eq vc-allow-rewriting-published-history 'ask) (yes-or-no-p (format "Commit %s appears published; allow rewriting history?" rev)))) diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index 1eaf531e2e1..32c5e9ce794 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -931,12 +931,17 @@ the ordinary way until you take special action. For example, for Git, see \"Recovering from Upstream Rebase\" in the Man page git-rebase(1). Normally, Emacs refuses to run VCS commands that it thinks will rewrite -published history. If you customize this variable to a non-nil value, -Emacs will instead prompt you to confirm that you really want to perform -the rewrite. A value of `no-ask' means to proceed with no prompting." +published history. If you customize this variable to `ask', Emacs will +instead prompt you to confirm that you really want to perform the +rewrite. Any other non-nil value means to proceed with no prompting. + +We recommend customizing this variable to `ask' or leaving it nil, +because if published history is rewritten unexpectedly it can be fairly +time-consuming to recover. Only customize this variable to a non-nil +value other than `ask' if you have a strong grasp of the VCS in use." :type '(choice (const :tag "Don't allow" nil) - (const :tag "Prompt to allow" t) - (const :tag "Allow without prompting" no-ask)) + (const :tag "Prompt to allow" ask) + (const :tag "Allow without prompting" t)) :version "31.1")