[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/git-commit 8fd16d3406: git-commit-post-finish-hook-timeout
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/git-commit 8fd16d3406: git-commit-post-finish-hook-timeout: New option |
Date: |
Mon, 26 Dec 2022 17:58:54 -0500 (EST) |
branch: elpa/git-commit
commit 8fd16d34068c54c1a0a6edcdccf60be1075a6915
Author: Lénaïc Huard <lenaic@lhuard.fr>
Commit: Jonas Bernoulli <jonas@bernoul.li>
git-commit-post-finish-hook-timeout: New option
`git-commit-post-finish-hook' is not run until the new commit has been
created. If Git takes more than 1 second to do so, the hook isn’t run.
Whereas a 1 second timeout seems reasonable for most use cases, there
are use cases where a greater time is desirable.
For ex., when git is configured to sign commits with GnuPG, the user
might be interactively prompted to enter the passphrase of the GnuPG
private key.
If the user takes more than 1 second to type their passphrase, the
hook isn’t run.
In order to address such use cases, the new variable
`git-commit-post-finish-hook-timeout' allows to tune the value of this
timeout.
Co-authored-by: Jonas Bernoulli <jonas@bernoul.li>
Name of new option and docstring tweaks.
---
lisp/git-commit.el | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git a/lisp/git-commit.el b/lisp/git-commit.el
index 4ca3a8ca86..52098e0316 100644
--- a/lisp/git-commit.el
+++ b/lisp/git-commit.el
@@ -230,10 +230,10 @@ to edit a commit message. If a commit is created without
the
user typing a message into a buffer, then this hook is not run.
This hook is not run until the new commit has been created. If
-doing so takes Git longer than one second, then this hook isn't
-run at all. For certain commands such as `magit-rebase-continue'
-this hook is never run because doing so would lead to a race
-condition.
+that takes Git longer than `git-commit-post-finish-hook-timeout'
+seconds, then this hook isn't run at all. For certain commands
+such as `magit-rebase-continue' this hook is never run because
+doing so would lead to a race condition.
This hook is only run if `magit' is available.
@@ -242,6 +242,17 @@ Also see `magit-post-commit-hook'."
:type 'hook
:get (and (featurep 'magit-base) #'magit-hook-custom-get))
+(defcustom git-commit-post-finish-hook-timeout 1
+ "Time in seconds to wait for git to create a commit.
+
+The hook `git-commit-post-finish-hook' (which see) is run only
+after git is done creating a commit. If it takes longer than
+`git-commit-post-finish-hook-timeout' seconds to create the
+commit, then the hook is not run at all."
+ :group 'git-commit
+ :safe 'numberp
+ :type 'number)
+
(defcustom git-commit-finish-query-functions
'(git-commit-check-style-conventions)
"List of functions called to query before performing commit.
@@ -596,7 +607,8 @@ to recover older messages")
(fboundp 'magit-rev-parse))
(cl-block nil
(let ((break (time-add (current-time)
- (seconds-to-time 1))))
+ (seconds-to-time
+ git-commit-post-finish-hook-timeout))))
(while (equal (magit-rev-parse "HEAD") previous)
(if (time-less-p (current-time) break)
(sit-for 0.01)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/git-commit 8fd16d3406: git-commit-post-finish-hook-timeout: New option,
ELPA Syncer <=