aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Whitton2024-10-24 11:26:27 +0800
committerSean Whitton2024-10-24 11:26:27 +0800
commit3bb1b85b78b8079e160dcb10774fe82c2daa1b4d (patch)
treeca4fce6051f1410a74d1a1cf56b6d1d69e1d61c8
parentbc8f416ee97795e77a36d6dd25a2a037bdc4a5c4 (diff)
downloademacs-3bb1b85b78b8079e160dcb10774fe82c2daa1b4d.tar.gz
emacs-3bb1b85b78b8079e160dcb10774fe82c2daa1b4d.zip
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.
-rw-r--r--lisp/vc/vc-git.el5
-rw-r--r--lisp/vc/vc.el15
2 files changed, 13 insertions, 7 deletions
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\"."
1966 "log" "--max-count=1" "--pretty=format:%B" rev))) 1966 "log" "--max-count=1" "--pretty=format:%B" rev)))
1967 1967
1968(defun vc-git--assert-allowed-rewrite (rev) 1968(defun vc-git--assert-allowed-rewrite (rev)
1969 (when (and (not (eq vc-allow-rewriting-published-history 'no-ask)) 1969 (when (and (not (and vc-allow-rewriting-published-history
1970 (not (eq vc-allow-rewriting-published-history 'ask))))
1970 ;; Check there is an upstream. 1971 ;; Check there is an upstream.
1971 (with-temp-buffer 1972 (with-temp-buffer
1972 (vc-git--out-ok "config" "--get" 1973 (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\"."
1978 "--pretty=format:%H" 1979 "--pretty=format:%H"
1979 "@{upstream}..HEAD"))))) 1980 "@{upstream}..HEAD")))))
1980 (unless (or (cl-member rev outgoing :test #'string-prefix-p) 1981 (unless (or (cl-member rev outgoing :test #'string-prefix-p)
1981 (and vc-allow-rewriting-published-history 1982 (and (eq vc-allow-rewriting-published-history 'ask)
1982 (yes-or-no-p 1983 (yes-or-no-p
1983 (format "Commit %s appears published; allow rewriting history?" 1984 (format "Commit %s appears published; allow rewriting history?"
1984 rev)))) 1985 rev))))
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 97b05362d8c..f64fd55f6a8 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,
931see \"Recovering from Upstream Rebase\" in the Man page git-rebase(1). 931see \"Recovering from Upstream Rebase\" in the Man page git-rebase(1).
932 932
933Normally, Emacs refuses to run VCS commands that it thinks will rewrite 933Normally, Emacs refuses to run VCS commands that it thinks will rewrite
934published history. If you customize this variable to a non-nil value, 934published history. If you customize this variable to `ask', Emacs will
935Emacs will instead prompt you to confirm that you really want to perform 935instead prompt you to confirm that you really want to perform the
936the rewrite. A value of `no-ask' means to proceed with no prompting." 936rewrite. Any other non-nil value means to proceed with no prompting.
937
938We recommend customizing this variable to `ask' or leaving it nil,
939because if published history is rewritten unexpectedly it can be fairly
940time-consuming to recover. Only customize this variable to a non-nil
941value other than `ask' if you have a strong grasp of the VCS in use."
937 :type '(choice (const :tag "Don't allow" nil) 942 :type '(choice (const :tag "Don't allow" nil)
938 (const :tag "Prompt to allow" t) 943 (const :tag "Prompt to allow" ask)
939 (const :tag "Allow without prompting" no-ask)) 944 (const :tag "Allow without prompting" t))
940 :version "31.1") 945 :version "31.1")
941 946
942 947