]> git.eshelyaron.com Git - emacs.git/commitdiff
vc-allow-rewriting-published-history: Use nil->ask->t
authorSean Whitton <spwhitton@spwhitton.name>
Thu, 24 Oct 2024 03:26:27 +0000 (11:26 +0800)
committerEshel Yaron <me@eshelyaron.com>
Fri, 25 Oct 2024 05:07:37 +0000 (07:07 +0200)
* 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)

lisp/vc/vc-git.el
lisp/vc/vc.el

index 899358339f3d96723a4f9305eb5cfb68e9d50117..f2dc584bba9392d836db430b80c6587d8e63a90d 100644 (file)
@@ -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))))
index 1eaf531e2e1a13b8bb333bc3ef9047124da70fde..32c5e9ce794e51e85c0a9c658824314c329b8308 100644 (file)
@@ -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")
 
 \f