branch: elpa/magit
commit fa629ad5b57d436669a9b65c8b73eb3d13aa1793
Author: Jonas Bernoulli <[email protected]>
Commit: Jonas Bernoulli <[email protected]>
magit-wip-mode: Avoid race condition
---
docs/magit.org | 4 ++++
docs/magit.texi | 4 ++++
lisp/magit-wip.el | 13 ++++++++++---
3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/docs/magit.org b/docs/magit.org
index 23584e0b002..6977ebf06dc 100644
--- a/docs/magit.org
+++ b/docs/magit.org
@@ -7752,6 +7752,10 @@ are being committed.
commit. With this setting wip commits are eventually garbage
collected.
+ If ~immediately~, then use ~git-commit-post-finish-hook~ to
+ create the merge commit. This is discouraged because it can
+ lead to a race condition, e.g., during rebases.
+
When ~magit-wip-merge-branch~ is ~t~, then the history looks like this:
#+begin_example
diff --git a/docs/magit.texi b/docs/magit.texi
index 425cce15902..a0c02c7cd0c 100644
--- a/docs/magit.texi
+++ b/docs/magit.texi
@@ -9330,6 +9330,10 @@ If nil and the current branch has new commits, then the
wip ref
is reset to the tip of the branch before creating a new wip
commit. With this setting wip commits are eventually garbage
collected.
+
+If @code{immediately}, then use @code{git-commit-post-finish-hook} to
+create the merge commit. This is discouraged because it can
+lead to a race condition, e.g., during rebases.
@end defopt
When @code{magit-wip-merge-branch} is @code{t}, then the history looks like
this:
diff --git a/lisp/magit-wip.el b/lisp/magit-wip.el
index e78c2e1e319..0621062611c 100644
--- a/lisp/magit-wip.el
+++ b/lisp/magit-wip.el
@@ -57,10 +57,17 @@ never garbage collected.
If nil and the current branch has new commits, then the wip ref
is reset to the tip of the branch before creating a new wip
commit. With this setting wip commits are eventually garbage
-collected. This is currently the default."
+collected. This is currently the default.
+
+If `immediately', then use `git-commit-post-finish-hook' to
+create the merge commit. This is discouraged because it can
+lead to a race condition, e.g., during rebases."
:package-version '(magit . "2.90.0")
:group 'magit-wip
- :type 'boolean)
+ :type '(choice
+ (const :tag "Yes (safely, just in time)" t)
+ (const :tag "Yes (immediately, with race condition)" immediately)
+ (const :tag "No" nil)))
(defcustom magit-wip-namespace "refs/wip/"
"Namespace used for work-in-progress refs.
@@ -132,7 +139,7 @@ is used as `branch-ref'."
(setq magit-wip-buffer-backed-up t)))
(defun magit-wip-commit-post-editmsg ()
- (when magit-wip-merge-branch
+ (when (eq magit-wip-merge-branch 'immediately)
(magit-wip-commit)))
;;; Core