git 1.19.1 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6f12803468275850ae680a4df2719890e8f84de95258f30dc898f817c7155d44
4
- data.tar.gz: d24540a708538775d2ff1af495f04e7f42a297aaf790d0fe7b65ad71fe402550
3
+ metadata.gz: b171ab737c87e925d5752b52f2f05bdd2361592624d88b8db8db380dde051019
4
+ data.tar.gz: d7b3b7cdaba4996288c4c0e8fffe7819da6c0933ade68ca810d9fb3519d5cda0
5
5
  SHA512:
6
- metadata.gz: 15a09f75d84fb1ff7547403eb36c7342bee11fc1a23cf86e5eae224a2494da0e0bc60bf288c04924c87bdf6736f156f4d98f0468cf815d03b3291509ab234e8d
7
- data.tar.gz: 7fe2633018ec2e38805b987271cc033d023b1a32b429cf2f75e88d1ac1c86c913689fc46806ea49c38fce66005215b05fc700ca3adc925afd0b3dcd3fefdc091
6
+ metadata.gz: '08dd5a4ea7b07230642e2dd87fca85ea634890f4700b77a996b3ff4443fc62d3c11a230c082c4d5b2c45c6c7d6916d9b98ce7362676e72d1a4bdd6f0fe2043e6'
7
+ data.tar.gz: 568111f5579b6b1728974dbfa12dc4d742f3715e951645dbed9a54d91399492157b77659b2e956ee995c142c8dbb01f3ee07357fb4db2a9c2bd0e1870e83dc79
@@ -0,0 +1,8 @@
1
+ Review our [guidelines for contributing](https://github.com/ruby-git/ruby-git/blob/master/CONTRIBUTING.md) to this repository. A good start is to:
2
+
3
+ * Write tests for your changes
4
+ * Run `rake` before pushing
5
+ * Include / update docs in the README.md and in YARD documentation
6
+
7
+ # Description
8
+
@@ -2,39 +2,33 @@ name: CI
2
2
 
3
3
  on:
4
4
  push:
5
- branches: [master]
5
+ branches: [master,v1]
6
6
  pull_request:
7
- branches: [master]
7
+ branches: [master,v1]
8
8
  workflow_dispatch:
9
9
 
10
10
  jobs:
11
- continuous_integration_build:
12
- continue-on-error: true
11
+ build:
12
+ name: Ruby ${{ matrix.ruby }} on ${{ matrix.operating-system }}
13
+ runs-on: ${{ matrix.operating-system }}
14
+ continue-on-error: ${{ matrix.experimental == 'Yes' }}
15
+ env: { JAVA_OPTS: -Djdk.io.File.enableADS=true }
16
+
13
17
  strategy:
14
18
  fail-fast: false
15
19
  matrix:
16
- ruby: [2.7, 3.0, 3.1, 3.2]
20
+ # Only the latest versions of JRuby and TruffleRuby are tested
21
+ ruby: ["3.0", "3.1", "3.2", "3.3", "truffleruby-24.0.0", "jruby-9.4.5.0"]
17
22
  operating-system: [ubuntu-latest]
23
+ experimental: [No]
18
24
  include:
19
- - ruby: head
20
- operating-system: ubuntu-latest
21
- - ruby: truffleruby-head
22
- operating-system: ubuntu-latest
23
- - ruby: 2.7
25
+ - # Only test with minimal Ruby version on Windows
26
+ ruby: 3.0
24
27
  operating-system: windows-latest
25
- - ruby: jruby-head
26
- operating-system: windows-latest
27
-
28
- name: Ruby ${{ matrix.ruby }} on ${{ matrix.operating-system }}
29
-
30
- runs-on: ${{ matrix.operating-system }}
31
-
32
- env:
33
- JAVA_OPTS: -Djdk.io.File.enableADS=true
34
28
 
35
29
  steps:
36
30
  - name: Checkout Code
37
- uses: actions/checkout@v3
31
+ uses: actions/checkout@v4
38
32
 
39
33
  - name: Setup Ruby
40
34
  uses: ruby/setup-ruby@v1
@@ -0,0 +1,43 @@
1
+ name: CI Experimental
2
+
3
+ on:
4
+ push:
5
+ branches: [master,v1]
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ build:
10
+ name: Ruby ${{ matrix.ruby }} on ${{ matrix.operating-system }}
11
+ runs-on: ${{ matrix.operating-system }}
12
+ continue-on-error: true
13
+ env: { JAVA_OPTS: -Djdk.io.File.enableADS=true }
14
+
15
+ strategy:
16
+ fail-fast: false
17
+ matrix:
18
+ include:
19
+ - # Building against head version of Ruby is considered experimental
20
+ ruby: head
21
+ operating-system: ubuntu-latest
22
+ experimental: Yes
23
+
24
+ - # Since JRuby on Windows is known to not work, consider this experimental
25
+ ruby: jruby-head
26
+ operating-system: windows-latest
27
+ experimental: Yes
28
+
29
+ steps:
30
+ - name: Checkout Code
31
+ uses: actions/checkout@v4
32
+
33
+ - name: Setup Ruby
34
+ uses: ruby/setup-ruby@v1
35
+ with:
36
+ ruby-version: ${{ matrix.ruby }}
37
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
38
+
39
+ - name: Run Build
40
+ run: bundle exec rake default
41
+
42
+ - name: Test Gem
43
+ run: bundle exec rake test:gem
data/CHANGELOG.md CHANGED
@@ -5,6 +5,94 @@
5
5
 
6
6
  # Change Log
7
7
 
8
+ ## v2.1.1 (2024-06-01)
9
+
10
+ [Full Changelog](https://github.com/ruby-git/ruby-git/compare/v2.1.0..v2.1.1)
11
+
12
+ Changes since v2.1.0:
13
+
14
+ * 6ce3d4d Handle ignored files with quoted (non-ASCII) filenames
15
+ * dd8e8d4 Supply all of the _specific_ color options too
16
+ * 749a72d Memoize all of the significant calls in Git::Status
17
+ * 2bacccc When core.ignoreCase, check for untracked files case-insensitively
18
+ * 7758ee4 When core.ignoreCase, check for deleted files case-insensitively
19
+ * 993eb78 When core.ignoreCase, check for added files case-insensitively
20
+ * d943bf4 When core.ignoreCase, check for changed files case-insensitively
21
+
22
+ ## v2.1.0 (2024-05-31)
23
+
24
+ [Full Changelog](https://github.com/ruby-git/ruby-git/compare/v2.0.1..v2.1.0)
25
+
26
+ Changes since v2.0.1:
27
+
28
+ * 93c8210 Add Git::Log#max_count
29
+ * d84097b Update YARDoc for a few a few method
30
+
31
+ ## v2.0.1 (2024-05-21)
32
+
33
+ [Full Changelog](https://github.com/ruby-git/ruby-git/compare/v2.0.0..v2.0.1)
34
+
35
+ Changes since v2.0.0:
36
+
37
+ * da435b1 Document and add tests for Git::Status
38
+ * c8a77db Fix Git::Base#status on an empty repo
39
+ * 712fdad Fix Git::Status#untracked when run from worktree subdir
40
+ * 6a59bc8 Remove the Git::Base::Factory module
41
+
42
+ ## v2.0.0 (2024-05-10)
43
+
44
+ [Full Changelog](https://github.com/ruby-git/ruby-git/compare/v2.0.0.pre4..v2.0.0)
45
+
46
+ Changes since v2.0.0.pre4:
47
+
48
+ * 1afc4c6 Update 2.x release line description
49
+ * ed52420 Make the pull request template more concise
50
+ * 299ae6b Remove stale bot integration
51
+ * efb724b Remove the DCO requirement for commits
52
+
53
+ ## v2.0.0.pre4 (2024-05-10)
54
+
55
+ [Full Changelog](https://jcouball@github.com/ruby-git/ruby-git/compare/v2.0.0.pre3..v2.0.0.pre4)
56
+
57
+ Changes since v2.0.0.pre3:
58
+
59
+ * 56783e7 Update create_github_release dependency so pre-releases can be made
60
+ * 8566929 Add dependency on create_github_release gem used for releasing the git gem
61
+ * 7376d76 Refactor errors that are raised by this gem
62
+ * 7e99b17 Update documentation for new timeout functionality
63
+ * 705e983 Move experimental builds to a separate workflow that only runs when pushed to master
64
+ * e056d64 Build with jruby-head on Windows until jruby/jruby#7515 is fixed
65
+ * ec7c257 Remove unneeded scripts to create a new release
66
+ * d9570ab Move issue and pull request templates to the .github directory
67
+ * e4d6a77 Show log(x).since combination in README
68
+
69
+ ## v2.0.0.pre3 (2024-03-15)
70
+
71
+ [Full Changelog](https://github.com/ruby-git/ruby-git/compare/v2.0.0.pre2..v2.0.0.pre3)
72
+
73
+ Changes since v2.0.0.pre2:
74
+
75
+ * 5d4b34e Allow allow_unrelated_histories option for Base#pull
76
+
77
+ ## v2.0.0.pre2 (2024-02-24)
78
+
79
+ [Full Changelog](https://github.com/ruby-git/ruby-git/compare/v2.0.0.pre1..v2.0.0.pre2)
80
+
81
+ Changes since v2.0.0.pre1:
82
+
83
+ * 023017b Add a timeout for git commands (#692)
84
+ * 8286ceb Refactor the Error heriarchy (#693)
85
+
86
+ ## v2.0.0.pre1 (2024-01-15)
87
+
88
+ [Full Changelog](https://github.com/ruby-git/ruby-git/compare/v1.19.1..v2.0.0.pre1)
89
+
90
+ Changes since v1.19.1:
91
+
92
+ * 7585c39 Change how the git CLI subprocess is executed (#684)
93
+ * f93e042 Update instructions for releasing a new version of the git gem (#686)
94
+ * f48930d Update minimum required version of Ruby and Git (#685)
95
+
8
96
  ## v1.19.1 (2024-01-13)
9
97
 
10
98
  [Full Changelog](https://github.com/ruby-git/ruby-git/compare/v1.19.0..v1.19.1)
data/CONTRIBUTING.md CHANGED
@@ -40,10 +40,6 @@ There is three step process for code or documentation changes:
40
40
 
41
41
  Make your changes in a fork of the ruby-git repository.
42
42
 
43
- Each commit must include a [DCO sign-off](#developer-certificate-of-origin-dco)
44
- by adding the line `Signed-off-by: Name <email>` to the end of the commit
45
- message.
46
-
47
43
  ### Create a pull request
48
44
 
49
45
  See [this article](https://help.github.com/articles/about-pull-requests/) if you
@@ -71,15 +67,18 @@ request meets [the project's coding standards](#coding-standards).
71
67
  In order to ensure high quality, all pull requests must meet these requirements:
72
68
 
73
69
  ### 1 PR = 1 Commit
74
- * All commits for a PR must be squashed into one commit
75
- * To avoid an extra merge commit, the PR must be able to be merged as [a fast forward merge](https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging)
76
- * The easiest way to ensure a fast forward merge is to rebase your local branch
77
- to the ruby-git master branch
70
+
71
+ * All commits for a PR must be squashed into one commit
72
+ * To avoid an extra merge commit, the PR must be able to be merged as [a fast forward
73
+ merge](https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging)
74
+ * The easiest way to ensure a fast forward merge is to rebase your local branch to
75
+ the ruby-git master branch
78
76
 
79
77
  ### Unit tests
80
- * All changes must be accompanied by new or modified unit tests
81
- * The entire test suite must pass when `bundle exec rake default` is run from the
82
- project's local working copy.
78
+
79
+ * All changes must be accompanied by new or modified unit tests
80
+ * The entire test suite must pass when `bundle exec rake default` is run from the
81
+ project's local working copy.
83
82
 
84
83
  While working on specific features you can run individual test files or
85
84
  a group of tests using `bin/test`:
@@ -94,20 +93,21 @@ a group of tests using `bin/test`:
94
93
  $ bin/test
95
94
 
96
95
  ### Continuous integration
97
- * All tests must pass in the project's [GitHub Continuous Integration build](https://github.com/ruby-git/ruby-git/actions?query=workflow%3ACI)
98
- before the pull request will be merged.
99
- * The [Continuous Integration workflow](https://github.com/ruby-git/ruby-git/blob/master/.github/workflows/continuous_integration.yml)
100
- runs both `bundle exec rake default` and `bundle exec rake test:gem` from the project's [Rakefile](https://github.com/ruby-git/ruby-git/blob/master/Rakefile).
96
+
97
+ * All tests must pass in the project's [GitHub Continuous Integration
98
+ build](https://github.com/ruby-git/ruby-git/actions?query=workflow%3ACI) before the
99
+ pull request will be merged.
100
+ * The [Continuous Integration
101
+ workflow](https://github.com/ruby-git/ruby-git/blob/master/.github/workflows/continuous_integration.yml)
102
+ runs both `bundle exec rake default` and `bundle exec rake test:gem` from the
103
+ project's [Rakefile](https://github.com/ruby-git/ruby-git/blob/master/Rakefile).
101
104
 
102
105
  ### Documentation
103
- * New and updated public methods must have [YARD](https://yardoc.org/)
104
- documentation added to them
105
- * New and updated public facing features should be documented in the project's
106
- [README.md](README.md)
107
106
 
108
- ### Licensing sign-off
109
- * Each commit must contain [the DCO sign-off](#developer-certificate-of-origin-dco)
110
- in the form: `Signed-off-by: Name <email>`
107
+ * New and updated public methods must have [YARD](https://yardoc.org/) documentation
108
+ added to them
109
+ * New and updated public facing features should be documented in the project's
110
+ [README.md](README.md)
111
111
 
112
112
  ## Licensing
113
113
 
@@ -116,48 +116,3 @@ declared in the [LICENSE](LICENSE) file.
116
116
 
117
117
  Licensing is very important to open source projects. It helps ensure the
118
118
  software continues to be available under the terms that the author desired.
119
-
120
- ### Developer Certificate of Origin (DCO)
121
-
122
- This project requires that authors have permission to submit their contributions
123
- under the MIT license. To make a good faith effort to ensure this, ruby-git
124
- requires the [Developer Certificate of Origin (DCO)](https://elinux.org/Developer_Certificate_Of_Origin)
125
- process be followed.
126
-
127
- This process requires that each commit include a `Signed-off-by` line that
128
- indicates the author accepts the DCO. Here is an example DCO sign-off line:
129
-
130
- ```
131
- Signed-off-by: John Doe <john.doe@hisdomain.com>
132
- ```
133
-
134
- The full text of the DCO version 1.1 is below or at <http://developercertificate.org/>.
135
-
136
- ```
137
- Developer's Certificate of Origin 1.1
138
-
139
- By making a contribution to this project, I certify that:
140
-
141
- (a) The contribution was created in whole or in part by me and I
142
- have the right to submit it under the open source license
143
- indicated in the file; or
144
-
145
- (b) The contribution is based upon previous work that, to the
146
- best of my knowledge, is covered under an appropriate open
147
- source license and I have the right under that license to
148
- submit that work with modifications, whether created in whole
149
- or in part by me, under the same open source license (unless
150
- I am permitted to submit under a different license), as
151
- Indicated in the file; or
152
-
153
- (c) The contribution was provided directly to me by some other
154
- person who certified (a), (b) or (c) and I have not modified
155
- it.
156
-
157
- (d) I understand and agree that this project and the contribution
158
- are public and that a record of the contribution (including
159
- all personal information I submit with it, including my
160
- sign-off) is maintained indefinitely and may be redistributed
161
- consistent with this project or the open source license(s)
162
- involved.
163
- ```
data/README.md CHANGED
@@ -11,66 +11,79 @@
11
11
  [![Build Status](https://github.com/ruby-git/ruby-git/workflows/CI/badge.svg?branch=master)](https://github.com/ruby-git/ruby-git/actions?query=workflow%3ACI)
12
12
  [![Code Climate](https://codeclimate.com/github/ruby-git/ruby-git.png)](https://codeclimate.com/github/ruby-git/ruby-git)
13
13
 
14
- The [git gem](https://rubygems.org/gems/git) provides an API that can be used to
15
- create, read, and manipulate Git repositories by wrapping system calls to the `git`
16
- command line. The API can be used for working with Git in complex interactions
17
- including branching and merging, object inspection and manipulation, history, patch
18
- generation and more.
14
+ * [Summary](#summary)
15
+ * [v2.x Release](#v2x-release)
16
+ * [Install](#install)
17
+ * [Major Objects](#major-objects)
18
+ * [Errors Raised By This Gem](#errors-raised-by-this-gem)
19
+ * [Specifying And Handling Timeouts](#specifying-and-handling-timeouts)
20
+ * [Examples](#examples)
21
+ * [Ruby version support policy](#ruby-version-support-policy)
22
+ * [License](#license)
19
23
 
20
- ## v2.0.0 pre-release
24
+ ## Summary
21
25
 
22
- git 2.0.0 is available as a pre-release version for testing! Please give it a try.
26
+ The [git gem](https://rubygems.org/gems/git) provides a Ruby interface to the `git`
27
+ command line.
28
+
29
+ Get started by obtaining a repository object by:
30
+
31
+ * opening an existing working copy with [Git.open](https://rubydoc.info/gems/git/Git#open-class_method)
32
+ * initializing a new repository with [Git.init](https://rubydoc.info/gems/git/Git#init-class_method)
33
+ * cloning a repository with [Git.clone](https://rubydoc.info/gems/git/Git#clone-class_method)
34
+
35
+ Methods that can be called on a repository object are documented in [Git::Base](https://rubydoc.info/gems/git/Git/Base)
36
+
37
+ ## v2.x Release
38
+
39
+ git 2.0.0 has recently been released. Please give it a try.
40
+
41
+ **If you have problems with the 2.x release, open an issue and use the 1.x version
42
+ instead.** We will do our best to fix your issues in a timely fashion.
23
43
 
24
44
  **JRuby on Windows is not yet supported by the 2.x release line. Users running JRuby
25
45
  on Windows should continue to use the 1.x release line.**
26
46
 
27
- The changes coming in this major release include:
47
+ The changes in this major release include:
28
48
 
49
+ * Added a dependency on the activesupport gem to use the deprecation functionality
29
50
  * Create a policy of supported Ruby versions to support only non-EOL Ruby versions
30
51
  * Create a policy of supported Git CLI versions (released 2020-12-25)
31
52
  * Update the required Ruby version to at least 3.0 (released 2020-07-27)
32
53
  * Update the required Git command line version to at least 2.28
33
54
  * Update how CLI commands are called to use the [process_executer](https://github.com/main-branch/process_executer)
34
55
  gem which is built on top of [Kernel.spawn](https://ruby-doc.org/3.3.0/Kernel.html#method-i-spawn).
35
- See [PR #617](https://github.com/ruby-git/ruby-git/pull/617) for more details
56
+ See [PR #684](https://github.com/ruby-git/ruby-git/pull/684) for more details
36
57
  on the motivation for this implementation.
37
58
 
38
- The tentative plan is to release `2.0.0` near the end of March 2024 depending on
39
- the feedback received during the pre-release period.
40
-
41
59
  The `master` branch will be used for `2.x` development. If needed, fixes for `1.x`
42
60
  version will be done on the `v1` branch.
43
61
 
44
- ## Homepage
45
-
46
- The project source code is at:
47
-
48
- http://github.com/ruby-git/ruby-git
49
-
50
- ## Documentation
51
-
52
- Detailed documentation can be found at:
53
-
54
- https://rubydoc.info/gems/git/Git.html
62
+ ## Install
55
63
 
56
- Get started by obtaining a repository object by:
64
+ Install the gem and add to the application's Gemfile by executing:
57
65
 
58
- * opening an existing working copy with [Git.open](https://rubydoc.info/gems/git/Git#open-class_method)
59
- * initializing a new repository with [Git.init](https://rubydoc.info/gems/git/Git#init-class_method)
60
- * cloning a repository with [Git.clone](https://rubydoc.info/gems/git/Git#clone-class_method)
66
+ ```shell
67
+ bundle add git
68
+ ```
61
69
 
62
- Methods that can be called on a repository object are documented in [Git::Base](https://rubydoc.info/gems/git/Git/Base)
70
+ to install version 1.x:
63
71
 
64
- ## Install
72
+ ```shell
73
+ bundle add git --version "~> 1.19"
74
+ ```
65
75
 
66
- You can install Ruby/Git like this:
76
+ If bundler is not being used to manage dependencies, install the gem by executing:
67
77
 
68
- ```
69
- sudo gem install git
78
+ ```shell
79
+ gem install git
70
80
  ```
71
81
 
72
- ## Code Status
82
+ to install version 1.x:
73
83
 
84
+ ```shell
85
+ gem install git --version "~> 1.19"
86
+ ```
74
87
 
75
88
  ## Major Objects
76
89
 
@@ -88,28 +101,112 @@ directory, in the index and in the repository. Similar to running 'git status'
88
101
 
89
102
  **Git::Remote**- A reference to a remote repository that is tracked by this repository.
90
103
 
91
- **Git::Log** - An Enumerable object that references all the `Git::Object::Commit` objects that encompass your log query, which can be constructed through methods on the `Git::Log object`,
92
- like:
104
+ **Git::Log** - An Enumerable object that references all the `Git::Object::Commit`
105
+ objects that encompass your log query, which can be constructed through methods on
106
+ the `Git::Log object`, like:
93
107
 
94
- `@git.log(20).object("some_file").since("2 weeks ago").between('v2.6', 'v2.7').each { |commit| [block] }`
108
+ ```ruby
109
+ git.log
110
+ .max_count(:all)
111
+ .object('README.md')
112
+ .since('10 years ago')
113
+ .between('v1.0.7', 'HEAD')
114
+ .map { |commit| commit.sha }
115
+ ```
95
116
 
96
- Pass the `--all` option to `git log` as follows:
117
+ A maximum of 30 commits are returned if `max_count` is not called. To get all commits
118
+ that match the log query, call `max_count(:all)`.
97
119
 
98
- `@git.log.all.each { |commit| [block] }`
120
+ Note that `git.log.all` adds the `--all` option to the underlying `git log` command.
121
+ This asks for the logs of all refs (basically all commits reachable by HEAD,
122
+ branches, and tags). This does not control the maximum number of commits returned. To
123
+ control how many commits are returned, you should call `max_count`.
99
124
 
100
- **Git::Worktrees** - Enumerable object that holds `Git::Worktree objects`.
125
+ **Git::Worktrees** - Enumerable object that holds `Git::Worktree objects`.
101
126
 
102
- ## Examples
127
+ ## Errors Raised By This Gem
103
128
 
104
- Here are a bunch of examples of how to use the Ruby/Git package.
129
+ The git gem will only raise an `ArgumentError` or an error that is a subclass of
130
+ `Git::Error`. It does not explicitly raise any other types of errors.
105
131
 
106
- Ruby < 1.9 will require rubygems to be loaded.
132
+ It is recommended to rescue `Git::Error` to catch any runtime error raised by
133
+ this gem unless you need more specific error handling.
107
134
 
108
135
  ```ruby
109
- require 'rubygems'
136
+ begin
137
+ # some git operation
138
+ rescue Git::Error => e
139
+ puts "An error occurred: #{e.message}"
140
+ end
110
141
  ```
111
142
 
143
+ See [`Git::Error`](https://rubydoc.info/gems/git/Git/Error) for more information.
144
+
145
+ ## Specifying And Handling Timeouts
146
+
147
+ The timeout feature was added in git gem version `2.0.0`.
148
+
149
+ A timeout for git command line operations can be set either globally or for specific
150
+ method calls that accept a `:timeout` parameter.
151
+
152
+ The timeout value must be a real, non-negative `Numeric` value that specifies a
153
+ number of seconds a `git` command will be given to complete before being sent a KILL
154
+ signal. This library may hang if the `git` command does not terminate after receiving
155
+ the KILL signal.
156
+
157
+ When a command times out, it is killed by sending it the `SIGKILL` signal and a
158
+ `Git::TimeoutError` is raised. This error derives from the `Git::SignaledError` and
159
+ `Git::Error`.
160
+
161
+ If the timeout value is `0` or `nil`, no timeout will be enforced.
162
+
163
+ If a method accepts a `:timeout` parameter and a receives a non-nil value, the value
164
+ of this parameter will override the global timeout value. In this context, a value of
165
+ `nil` (which is usually the default) will use the global timeout value and a value of
166
+ `0` will turn off timeout enforcement for that method call no matter what the global
167
+ value is.
168
+
169
+ To set a global timeout, use the `Git.config` object:
170
+
171
+ ```ruby
172
+ Git.config.timeout = nil # a value of nil or 0 means no timeout is enforced
173
+ Git.config.timeout = 1.5 # can be any real, non-negative Numeric interpreted as number of seconds
174
+ ```
175
+
176
+ The global timeout can be overridden for a specific method if the method accepts a
177
+ `:timeout` parameter:
178
+
179
+ ```ruby
180
+ repo_url = 'https://github.com/ruby-git/ruby-git.git'
181
+ Git.clone(repo_url) # Use the global timeout value
182
+ Git.clone(repo_url, timeout: nil) # Also uses the global timeout value
183
+ Git.clone(repo_url, timeout: 0) # Do not enforce a timeout
184
+ Git.clone(repo_url, timeout: 10.5) # Timeout after 10.5 seconds raising Git::SignaledError
185
+ ```
186
+
187
+ If the command takes too long, a `Git::TimeoutError` will be raised:
188
+
189
+ ```ruby
190
+ begin
191
+ Git.clone(repo_url, timeout: 10)
192
+ rescue Git::TimeoutError => e
193
+ e.result.tap do |r|
194
+ r.class #=> Git::CommandLineResult
195
+ r.status #=> #<Process::Status: pid 62173 SIGKILL (signal 9)>
196
+ r.status.timeout? #=> true
197
+ r.git_cmd # The git command ran as an array of strings
198
+ r.stdout # The command's output to stdout until it was terminated
199
+ r.stderr # The command's output to stderr until it was terminated
200
+ end
201
+ end
202
+ ```
203
+
204
+ ## Examples
205
+
206
+ Here are a bunch of examples of how to use the Ruby/Git package.
207
+
112
208
  Require the 'git' gem.
209
+
113
210
  ```ruby
114
211
  require 'git'
115
212
  ```
@@ -139,9 +236,12 @@ g.index.writable?
139
236
  g.repo
140
237
  g.dir
141
238
 
142
- g.log # returns a Git::Log object, which is an Enumerator of Git::Commit objects
143
- g.log(200)
144
- g.log.since('2 weeks ago')
239
+ # log - returns a Git::Log object, which is an Enumerator of Git::Commit objects
240
+ # default configuration returns a max of 30 commits
241
+ g.log
242
+ g.log(200) # 200 most recent commits
243
+ g.log.since('2 weeks ago') # default count of commits since 2 weeks ago.
244
+ g.log(200).since('2 weeks ago') # commits since 2 weeks ago, limited to 200.
145
245
  g.log.between('v2.5', 'v2.6')
146
246
  g.log.each {|l| puts l.sha }
147
247
  g.gblob('v2.5:Makefile').log.since('2 weeks ago')
@@ -276,11 +376,11 @@ g.add(:all=>true) # git add --all -- "."
276
376
  g.add('file_path') # git add -- "file_path"
277
377
  g.add(['file_path_1', 'file_path_2']) # git add -- "file_path_1" "file_path_2"
278
378
 
279
- g.remove() # git rm -f -- "."
280
- g.remove('file.txt') # git rm -f -- "file.txt"
281
- g.remove(['file.txt', 'file2.txt']) # git rm -f -- "file.txt" "file2.txt"
282
- g.remove('file.txt', :recursive => true) # git rm -f -r -- "file.txt"
283
- g.remove('file.txt', :cached => true) # git rm -f --cached -- "file.txt"
379
+ g.remove() # git rm -f -- "."
380
+ g.remove('file.txt') # git rm -f -- "file.txt"
381
+ g.remove(['file.txt', 'file2.txt']) # git rm -f -- "file.txt" "file2.txt"
382
+ g.remove('file.txt', :recursive => true) # git rm -f -r -- "file.txt"
383
+ g.remove('file.txt', :cached => true) # git rm -f --cached -- "file.txt"
284
384
 
285
385
  g.commit('message')
286
386
  g.commit_all('message')
@@ -422,6 +522,20 @@ g.with_temp_working(dir) do
422
522
  end
423
523
  ```
424
524
 
525
+ ## Ruby version support policy
526
+
527
+ This gem will be expected to function correctly on:
528
+
529
+ * All non-EOL versions of the MRI Ruby on Mac, Linux, and Windows
530
+ * The latest version of JRuby on Linux
531
+ * The latest version of Truffle Ruby on Linus
532
+
533
+ It is this project's intent to support the latest version of JRuby on Windows
534
+ once the following JRuby bug is fixed:
535
+
536
+ jruby/jruby#7515
537
+
425
538
  ## License
426
539
 
427
- licensed under MIT License Copyright (c) 2008 Scott Chacon. See LICENSE for further details.
540
+ Licensed under MIT License Copyright (c) 2008 Scott Chacon. See LICENSE for further
541
+ details.