Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Your checklist for this pull request
馃毃Please review the guidelines for contributing to this repository.
Description
This PR adds the ability to specify a timeout (either globally or for a specific git command). Addresses feature request in #690.
From the updated README.md:
A timeout for git operations can be set either globally or for specific method calls
that accept a
:timeout
parameter.The timeout value must be a real, non-negative
Numeric
value that specifies anumber of seconds a
git
command will be given to complete before being sent a KILLsignal. This library may hang if the
git
command does not terminate after receivingthe KILL signal.
When a command times out, a
Git::SignaledError
is raised.If the timeout value is
0
ornil
, no timeout will be enforced.If a method accepts a
:timeout
parameter and a receives a non-nil value, it willoverride the global timeout value. In this context, a value of
nil
(which isusually the default) will use the global timeout value and a value of
0
will turnoff timeout enforcement for that method call no matter what the global value is.
To set a global timeout, use the
Git.config
object:The global timeout can be overridden for a specific method if the method accepts a
:timeout
parameter:If the command takes too long, a
Git::SignaledError
will be raised: