git 2.0.0.pre2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/pull_request_template.md +8 -0
- data/.github/workflows/continuous_integration.yml +0 -10
- data/.github/workflows/experimental_continuous_integration.yml +43 -0
- data/CHANGELOG.md +35 -0
- data/CONTRIBUTING.md +22 -67
- data/README.md +63 -70
- data/git.gemspec +2 -0
- data/lib/git/base.rb +21 -8
- data/lib/git/command_line.rb +21 -12
- data/lib/git/errors.rb +206 -0
- data/lib/git/lib.rb +42 -19
- data/lib/git/object.rb +69 -67
- data/lib/git/version.rb +1 -1
- data/lib/git.rb +7 -10
- metadata +37 -15
- data/.github/stale.yml +0 -25
- data/Dockerfile.changelog-rs +0 -12
- data/PULL_REQUEST_TEMPLATE.md +0 -9
- data/lib/git/command_line_error.rb +0 -59
- data/lib/git/error.rb +0 -7
- data/lib/git/failed_error.rb +0 -14
- data/lib/git/git_execute_error.rb +0 -14
- data/lib/git/signaled_error.rb +0 -14
- data/lib/git/timeout_error.rb +0 -60
- /data/{ISSUE_TEMPLATE.md → .github/issue_template.md} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ebad290719cdefc27125cf9a2ebb0d3544334c2d49a079220c0714a701ce141
|
4
|
+
data.tar.gz: 293499cbb61ca9b4d374e86d0bd4357ed3f3b1254a46aa57c095cf0816afd7f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fc0929f6ff79eea57f5dbd5f05da813bb55f6c44f925ce45f4ad4f3a011c99e3cfa2d00c4a18824e1521ab975fa70057127b143d77e301f0d5d2382cd4d7480
|
7
|
+
data.tar.gz: 5ef0e326223cc983605c8afc002e3fe77808d337a3a3dcfd1b25588adf58b5c697a3451fd8baae777f727a5f2ba3cb92f2c3e811c79bc9f5da836b24ad5a8a6b
|
@@ -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
|
+
|
@@ -22,20 +22,10 @@ jobs:
|
|
22
22
|
operating-system: [ubuntu-latest]
|
23
23
|
experimental: [No]
|
24
24
|
include:
|
25
|
-
- # Building against head version of Ruby is considered experimental
|
26
|
-
ruby: head
|
27
|
-
operating-system: ubuntu-latest
|
28
|
-
experimental: Yes
|
29
|
-
|
30
25
|
- # Only test with minimal Ruby version on Windows
|
31
26
|
ruby: 3.0
|
32
27
|
operating-system: windows-latest
|
33
28
|
|
34
|
-
- # Since JRuby on Windows is known to not work, consider this experimental
|
35
|
-
ruby: jruby-9.4.5.0
|
36
|
-
operating-system: windows-latest
|
37
|
-
experimental: Yes
|
38
|
-
|
39
29
|
steps:
|
40
30
|
- name: Checkout Code
|
41
31
|
uses: actions/checkout@v4
|
@@ -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,41 @@
|
|
5
5
|
|
6
6
|
# Change Log
|
7
7
|
|
8
|
+
## v2.0.0 (2024-05-10)
|
9
|
+
|
10
|
+
[Full Changelog](https://github.com/ruby-git/ruby-git/compare/v2.0.0.pre4..v2.0.0)
|
11
|
+
|
12
|
+
Changes since v2.0.0.pre4:
|
13
|
+
|
14
|
+
* 1afc4c6 Update 2.x release line description
|
15
|
+
* ed52420 Make the pull request template more concise
|
16
|
+
* 299ae6b Remove stale bot integration
|
17
|
+
* efb724b Remove the DCO requirement for commits
|
18
|
+
|
19
|
+
## v2.0.0.pre4 (2024-05-10)
|
20
|
+
|
21
|
+
[Full Changelog](https://jcouball@github.com/ruby-git/ruby-git/compare/v2.0.0.pre3..v2.0.0.pre4)
|
22
|
+
|
23
|
+
Changes since v2.0.0.pre3:
|
24
|
+
|
25
|
+
* 56783e7 Update create_github_release dependency so pre-releases can be made
|
26
|
+
* 8566929 Add dependency on create_github_release gem used for releasing the git gem
|
27
|
+
* 7376d76 Refactor errors that are raised by this gem
|
28
|
+
* 7e99b17 Update documentation for new timeout functionality
|
29
|
+
* 705e983 Move experimental builds to a separate workflow that only runs when pushed to master
|
30
|
+
* e056d64 Build with jruby-head on Windows until jruby/jruby#7515 is fixed
|
31
|
+
* ec7c257 Remove unneeded scripts to create a new release
|
32
|
+
* d9570ab Move issue and pull request templates to the .github directory
|
33
|
+
* e4d6a77 Show log(x).since combination in README
|
34
|
+
|
35
|
+
## v2.0.0.pre3 (2024-03-15)
|
36
|
+
|
37
|
+
[Full Changelog](https://github.com/ruby-git/ruby-git/compare/v2.0.0.pre2..v2.0.0.pre3)
|
38
|
+
|
39
|
+
Changes since v2.0.0.pre2:
|
40
|
+
|
41
|
+
* 5d4b34e Allow allow_unrelated_histories option for Base#pull
|
42
|
+
|
8
43
|
## v2.0.0.pre2 (2024-02-24)
|
9
44
|
|
10
45
|
[Full Changelog](https://github.com/ruby-git/ruby-git/compare/v2.0.0.pre1..v2.0.0.pre2)
|
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
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
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
|
-
|
81
|
-
|
82
|
-
|
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
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
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
|
-
|
109
|
-
|
110
|
-
|
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
@@ -12,7 +12,7 @@
|
|
12
12
|
[](https://codeclimate.com/github/ruby-git/ruby-git)
|
13
13
|
|
14
14
|
* [Summary](#summary)
|
15
|
-
* [v2.
|
15
|
+
* [v2.x Release](#v2x-release)
|
16
16
|
* [Install](#install)
|
17
17
|
* [Major Objects](#major-objects)
|
18
18
|
* [Errors Raised By This Gem](#errors-raised-by-this-gem)
|
@@ -37,15 +37,20 @@ Get started by obtaining a repository object by:
|
|
37
37
|
|
38
38
|
Methods that can be called on a repository object are documented in [Git::Base](https://rubydoc.info/gems/git/Git/Base)
|
39
39
|
|
40
|
-
## v2.
|
40
|
+
## v2.x Release
|
41
41
|
|
42
|
-
git 2.0.0
|
42
|
+
git 2.0.0 has recently been released. Please give it a try.
|
43
|
+
|
44
|
+
|
45
|
+
**If you have problems with the 2.x release, open an issue and use the 1.9.1 version
|
46
|
+
instead.** We will do our best to fix your issues in a timely fashion.
|
43
47
|
|
44
48
|
**JRuby on Windows is not yet supported by the 2.x release line. Users running JRuby
|
45
49
|
on Windows should continue to use the 1.x release line.**
|
46
50
|
|
47
|
-
The changes
|
51
|
+
The changes in this major release include:
|
48
52
|
|
53
|
+
* Added a dependency on the activesupport gem to use the deprecation functionality
|
49
54
|
* Create a policy of supported Ruby versions to support only non-EOL Ruby versions
|
50
55
|
* Create a policy of supported Git CLI versions (released 2020-12-25)
|
51
56
|
* Update the required Ruby version to at least 3.0 (released 2020-07-27)
|
@@ -55,9 +60,6 @@ The changes coming in this major release include:
|
|
55
60
|
See [PR #684](https://github.com/ruby-git/ruby-git/pull/684) for more details
|
56
61
|
on the motivation for this implementation.
|
57
62
|
|
58
|
-
The tentative plan is to release `2.0.0` near the end of March 2024 depending on
|
59
|
-
the feedback received during the pre-release period.
|
60
|
-
|
61
63
|
The `master` branch will be used for `2.x` development. If needed, fixes for `1.x`
|
62
64
|
version will be done on the `v1` branch.
|
63
65
|
|
@@ -69,12 +71,24 @@ Install the gem and add to the application's Gemfile by executing:
|
|
69
71
|
bundle add git
|
70
72
|
```
|
71
73
|
|
74
|
+
to install version 1.x:
|
75
|
+
|
76
|
+
```shell
|
77
|
+
bundle add git --version "~> 1.19"
|
78
|
+
```
|
79
|
+
|
72
80
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
73
81
|
|
74
82
|
```shell
|
75
83
|
gem install git
|
76
84
|
```
|
77
85
|
|
86
|
+
to install version 1.x:
|
87
|
+
|
88
|
+
```shell
|
89
|
+
gem install git --version "~> 1.19"
|
90
|
+
```
|
91
|
+
|
78
92
|
## Major Objects
|
79
93
|
|
80
94
|
**Git::Base** - The object returned from a `Git.open` or `Git.clone`. Most major actions are called from this object.
|
@@ -104,76 +118,45 @@ Pass the `--all` option to `git log` as follows:
|
|
104
118
|
|
105
119
|
## Errors Raised By This Gem
|
106
120
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
Error heirarchy:
|
121
|
+
The git gem will only raise an `ArgumentError` or an error that is a subclass of
|
122
|
+
`Git::Error`. It does not explicitly raise any other types of errors.
|
111
123
|
|
112
|
-
|
113
|
-
|
114
|
-
└── CommandLineError
|
115
|
-
├── FailedError
|
116
|
-
└── SignaledError
|
117
|
-
└── TimeoutError
|
118
|
-
```
|
119
|
-
|
120
|
-
Other standard errors may also be raised like `ArgumentError`. Each method should
|
121
|
-
document the errors it may raise.
|
122
|
-
|
123
|
-
Description of each Error class:
|
124
|
-
|
125
|
-
* `Error`: This catch-all error serves as the base class for other custom errors in this
|
126
|
-
gem. Errors of this class are raised when no more approriate specific error to
|
127
|
-
raise.
|
128
|
-
* `CommandLineError`: This error is raised when there's a problem executing the git
|
129
|
-
command line. This gem will raise a more specific error depending on how the
|
130
|
-
command line failed.
|
131
|
-
* `FailedError`: This error is raised when the git command line exits with a non-zero
|
132
|
-
status code that is not expected by the git gem.
|
133
|
-
* `SignaledError`: This error is raised when the git command line is terminated as a
|
134
|
-
result of receiving a signal. This could happen if the process is forcibly
|
135
|
-
terminated or if there is a serious system error.
|
136
|
-
* `TimeoutError`: This is a specific type of `SignaledError` that is raised when the
|
137
|
-
git command line operation times out and is killed via the SIGKILL signal. This
|
138
|
-
happens if the operation takes longer than the timeout duration configured in
|
139
|
-
`Git.config.timeout` or via the `:timeout` parameter given in git methods that
|
140
|
-
support this parameter.
|
141
|
-
|
142
|
-
`Git::GitExecuteError` remains as an alias for `Git::Error`. It is considered
|
143
|
-
deprecated as of git-2.0.0.
|
144
|
-
|
145
|
-
Here is an example of catching errors when using the git gem:
|
124
|
+
It is recommended to rescue `Git::Error` to catch any runtime error raised by
|
125
|
+
this gem unless you need more specific error handling.
|
146
126
|
|
147
127
|
```ruby
|
148
128
|
begin
|
149
|
-
|
150
|
-
repo = Git.clone('https://github.com/ruby-git/ruby-git', 'ruby-git-temp', timeout: timeout_duration)
|
151
|
-
rescue Git::TimeoutError => e # Catch the more specific error first!
|
152
|
-
puts "Git clone took too long and timed out #{e}"
|
129
|
+
# some git operation
|
153
130
|
rescue Git::Error => e
|
154
|
-
puts "
|
131
|
+
puts "An error occurred: #{e.message}"
|
132
|
+
end
|
155
133
|
```
|
156
134
|
|
135
|
+
See [`Git::Error`](https://rubydoc.info/gems/git/Git/Error) for more information.
|
136
|
+
|
157
137
|
## Specifying And Handling Timeouts
|
158
138
|
|
159
139
|
The timeout feature was added in git gem version `2.0.0`.
|
160
140
|
|
161
|
-
A timeout for git operations can be set either globally or for specific
|
162
|
-
that accept a `:timeout` parameter.
|
141
|
+
A timeout for git command line operations can be set either globally or for specific
|
142
|
+
method calls that accept a `:timeout` parameter.
|
163
143
|
|
164
144
|
The timeout value must be a real, non-negative `Numeric` value that specifies a
|
165
145
|
number of seconds a `git` command will be given to complete before being sent a KILL
|
166
146
|
signal. This library may hang if the `git` command does not terminate after receiving
|
167
147
|
the KILL signal.
|
168
148
|
|
169
|
-
When a command times out,
|
149
|
+
When a command times out, it is killed by sending it the `SIGKILL` signal and a
|
150
|
+
`Git::TimeoutError` is raised. This error derives from the `Git::SignaledError` and
|
151
|
+
`Git::Error`.
|
170
152
|
|
171
153
|
If the timeout value is `0` or `nil`, no timeout will be enforced.
|
172
154
|
|
173
|
-
If a method accepts a `:timeout` parameter and a receives a non-nil value,
|
174
|
-
override the global timeout value. In this context, a value of
|
175
|
-
usually the default) will use the global timeout value and a value of
|
176
|
-
off timeout enforcement for that method call no matter what the global
|
155
|
+
If a method accepts a `:timeout` parameter and a receives a non-nil value, the value
|
156
|
+
of this parameter will override the global timeout value. In this context, a value of
|
157
|
+
`nil` (which is usually the default) will use the global timeout value and a value of
|
158
|
+
`0` will turn off timeout enforcement for that method call no matter what the global
|
159
|
+
value is.
|
177
160
|
|
178
161
|
To set a global timeout, use the `Git.config` object:
|
179
162
|
|
@@ -193,19 +176,20 @@ Git.clone(repo_url, timeout: 0) # Do not enforce a timeout
|
|
193
176
|
Git.clone(repo_url, timeout: 10.5) # Timeout after 10.5 seconds raising Git::SignaledError
|
194
177
|
```
|
195
178
|
|
196
|
-
If the command takes too long, a `Git::
|
179
|
+
If the command takes too long, a `Git::TimeoutError` will be raised:
|
197
180
|
|
198
181
|
```ruby
|
199
182
|
begin
|
200
183
|
Git.clone(repo_url, timeout: 10)
|
201
184
|
rescue Git::TimeoutError => e
|
202
|
-
result
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
185
|
+
e.result.tap do |r|
|
186
|
+
r.class #=> Git::CommandLineResult
|
187
|
+
r.status #=> #<Process::Status: pid 62173 SIGKILL (signal 9)>
|
188
|
+
r.status.timeout? #=> true
|
189
|
+
r.git_cmd # The git command ran as an array of strings
|
190
|
+
r.stdout # The command's output to stdout until it was terminated
|
191
|
+
r.stderr # The command's output to stderr until it was terminated
|
192
|
+
end
|
209
193
|
end
|
210
194
|
```
|
211
195
|
|
@@ -244,9 +228,12 @@ g.index.writable?
|
|
244
228
|
g.repo
|
245
229
|
g.dir
|
246
230
|
|
247
|
-
|
248
|
-
|
249
|
-
g.log
|
231
|
+
# log - returns a Git::Log object, which is an Enumerator of Git::Commit objects
|
232
|
+
# default configuration returns a max of 30 commits
|
233
|
+
g.log
|
234
|
+
g.log(200) # 200 most recent commits
|
235
|
+
g.log.since('2 weeks ago') # default count of commits since 2 weeks ago.
|
236
|
+
g.log(200).since('2 weeks ago') # commits since 2 weeks ago, limited to 200.
|
250
237
|
g.log.between('v2.5', 'v2.6')
|
251
238
|
g.log.each {|l| puts l.sha }
|
252
239
|
g.gblob('v2.5:Makefile').log.since('2 weeks ago')
|
@@ -532,9 +519,15 @@ end
|
|
532
519
|
This gem will be expected to function correctly on:
|
533
520
|
|
534
521
|
* All non-EOL versions of the MRI Ruby on Mac, Linux, and Windows
|
535
|
-
* The latest version of JRuby on Linux
|
522
|
+
* The latest version of JRuby on Linux
|
536
523
|
* The latest version of Truffle Ruby on Linus
|
537
524
|
|
525
|
+
It is this project's intent to support the latest version of JRuby on Windows
|
526
|
+
once the following JRuby bug is fixed:
|
527
|
+
|
528
|
+
jruby/jruby#7515
|
529
|
+
|
538
530
|
## License
|
539
531
|
|
540
|
-
|
532
|
+
Licensed under MIT License Copyright (c) 2008 Scott Chacon. See LICENSE for further
|
533
|
+
details.
|
data/git.gemspec
CHANGED
@@ -27,10 +27,12 @@ Gem::Specification.new do |s|
|
|
27
27
|
s.required_ruby_version = '>= 3.0.0'
|
28
28
|
s.requirements = ['git 2.28.0 or greater']
|
29
29
|
|
30
|
+
s.add_runtime_dependency 'activesupport', '>= 5.0'
|
30
31
|
s.add_runtime_dependency 'addressable', '~> 2.8'
|
31
32
|
s.add_runtime_dependency 'process_executer', '~> 1.1'
|
32
33
|
s.add_runtime_dependency 'rchardet', '~> 1.8'
|
33
34
|
|
35
|
+
s.add_development_dependency 'create_github_release', '~> 1.4'
|
34
36
|
s.add_development_dependency 'minitar', '~> 0.9'
|
35
37
|
s.add_development_dependency 'mocha', '~> 2.1'
|
36
38
|
s.add_development_dependency 'rake', '~> 13.1'
|
data/lib/git/base.rb
CHANGED
@@ -409,14 +409,27 @@ module Git
|
|
409
409
|
self.lib.conflicts(&block)
|
410
410
|
end
|
411
411
|
|
412
|
-
#
|
413
|
-
#
|
414
|
-
#
|
415
|
-
#
|
416
|
-
#
|
417
|
-
#
|
418
|
-
|
419
|
-
|
412
|
+
# Pulls the given branch from the given remote into the current branch
|
413
|
+
#
|
414
|
+
# @param remote [String] the remote repository to pull from
|
415
|
+
# @param branch [String] the branch to pull from
|
416
|
+
# @param opts [Hash] options to pass to the pull command
|
417
|
+
#
|
418
|
+
# @option opts [Boolean] :allow_unrelated_histories (false) Merges histories of two projects that started their
|
419
|
+
# lives independently
|
420
|
+
# @example pulls from origin/master
|
421
|
+
# @git.pull
|
422
|
+
# @example pulls from upstream/master
|
423
|
+
# @git.pull('upstream')
|
424
|
+
# @example pulls from upstream/develop
|
425
|
+
# @git.pull('upstream', 'develop')
|
426
|
+
#
|
427
|
+
# @return [Void]
|
428
|
+
#
|
429
|
+
# @raise [Git::FailedError] if the pull fails
|
430
|
+
# @raise [ArgumentError] if a branch is given without a remote
|
431
|
+
def pull(remote = nil, branch = nil, opts = {})
|
432
|
+
self.lib.pull(remote, branch, opts)
|
420
433
|
end
|
421
434
|
|
422
435
|
# returns an array of Git:Remote objects
|
data/lib/git/command_line.rb
CHANGED
@@ -2,8 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'git/base'
|
4
4
|
require 'git/command_line_result'
|
5
|
-
require 'git/
|
6
|
-
require 'git/signaled_error'
|
5
|
+
require 'git/errors'
|
7
6
|
require 'stringio'
|
8
7
|
|
9
8
|
module Git
|
@@ -114,7 +113,6 @@ module Git
|
|
114
113
|
# the normalize option will be ignored.
|
115
114
|
#
|
116
115
|
# @example Run a command and return the output
|
117
|
-
#
|
118
116
|
# cli.run('version') #=> "git version 2.39.1\n"
|
119
117
|
#
|
120
118
|
# @example The args array should be splatted into the parameter list
|
@@ -162,14 +160,18 @@ module Git
|
|
162
160
|
# `stderr_writer.string` will be merged into the output returned by this method.
|
163
161
|
#
|
164
162
|
# @param normalize [Boolean] whether to normalize the output to a valid encoding
|
163
|
+
#
|
165
164
|
# @param chomp [Boolean] whether to chomp the output
|
165
|
+
#
|
166
166
|
# @param merge [Boolean] whether to merge stdout and stderr in the string returned
|
167
|
+
#
|
167
168
|
# @param chdir [String] the directory to run the command in
|
168
169
|
#
|
169
170
|
# @param timeout [Numeric, nil] the maximum seconds to wait for the command to complete
|
170
171
|
#
|
171
|
-
# If timeout is zero
|
172
|
-
#
|
172
|
+
# If timeout is zero, the timeout will not be enforced.
|
173
|
+
#
|
174
|
+
# If the command times out, it is killed via a `SIGKILL` signal and `Git::TimeoutError` is raised.
|
173
175
|
#
|
174
176
|
# If the command does not respond to SIGKILL, it will hang this method.
|
175
177
|
#
|
@@ -178,9 +180,13 @@ module Git
|
|
178
180
|
# This result of running the command.
|
179
181
|
#
|
180
182
|
# @raise [ArgumentError] if `args` is not an array of strings
|
183
|
+
#
|
181
184
|
# @raise [Git::SignaledError] if the command was terminated because of an uncaught signal
|
185
|
+
#
|
182
186
|
# @raise [Git::FailedError] if the command returned a non-zero exitstatus
|
183
|
-
#
|
187
|
+
#
|
188
|
+
# @raise [Git::ProcessIOError] if an exception was raised while collecting subprocess output
|
189
|
+
#
|
184
190
|
# @raise [Git::TimeoutError] if the command times out
|
185
191
|
#
|
186
192
|
def run(*args, out:, err:, normalize:, chomp:, merge:, chdir: nil, timeout: nil)
|
@@ -253,28 +259,28 @@ module Git
|
|
253
259
|
# @param pipe_name [Symbol] the name of the pipe that raised the exception
|
254
260
|
# @param pipe [ProcessExecuter::MonitoredPipe] the pipe that raised the exception
|
255
261
|
#
|
256
|
-
# @raise [Git::
|
262
|
+
# @raise [Git::ProcessIOError]
|
257
263
|
#
|
258
264
|
# @return [void] this method always raises an error
|
259
265
|
#
|
260
266
|
# @api private
|
261
267
|
#
|
262
268
|
def raise_pipe_error(git_cmd, pipe_name, pipe)
|
263
|
-
raise Git::
|
269
|
+
raise Git::ProcessIOError.new("Pipe Exception for #{git_cmd}: #{pipe_name}"), cause: pipe.exception
|
264
270
|
end
|
265
271
|
|
266
272
|
# Execute the git command and collect the output
|
267
273
|
#
|
268
274
|
# @param cmd [Array<String>] the git command to execute
|
269
275
|
# @param chdir [String] the directory to run the command in
|
270
|
-
# @param timeout [
|
276
|
+
# @param timeout [Numeric, nil] the maximum seconds to wait for the command to complete
|
271
277
|
#
|
272
278
|
# If timeout is zero of nil, the command will not time out. If the command
|
273
279
|
# times out, it is killed via a SIGKILL signal and `Git::TimeoutError` is raised.
|
274
280
|
#
|
275
281
|
# If the command does not respond to SIGKILL, it will hang this method.
|
276
282
|
#
|
277
|
-
# @raise [Git::
|
283
|
+
# @raise [Git::ProcessIOError] if an exception was raised while collecting subprocess output
|
278
284
|
# @raise [Git::TimeoutError] if the command times out
|
279
285
|
#
|
280
286
|
# @return [ProcessExecuter::Status] the status of the completed subprocess
|
@@ -321,11 +327,14 @@ module Git
|
|
321
327
|
# @param err [#write] the object that stderr was written to
|
322
328
|
# @param normalize [Boolean] whether to normalize the output of each writer
|
323
329
|
# @param chomp [Boolean] whether to chomp the output of each writer
|
330
|
+
# @param timeout [Numeric, nil] the maximum seconds to wait for the command to complete
|
324
331
|
#
|
325
332
|
# @return [Git::CommandLineResult] the result of the command to return to the caller
|
326
333
|
#
|
327
334
|
# @raise [Git::FailedError] if the command failed
|
328
335
|
# @raise [Git::SignaledError] if the command was signaled
|
336
|
+
# @raise [Git::TimeoutError] if the command times out
|
337
|
+
# @raise [Git::ProcessIOError] if an exception was raised while collecting subprocess output
|
329
338
|
#
|
330
339
|
# @api private
|
331
340
|
#
|
@@ -346,14 +355,14 @@ module Git
|
|
346
355
|
# @param out [#write] the object to write stdout to
|
347
356
|
# @param err [#write] the object to write stderr to
|
348
357
|
# @param chdir [String] the directory to run the command in
|
349
|
-
# @param timeout [
|
358
|
+
# @param timeout [Numeric, nil] the maximum seconds to wait for the command to complete
|
350
359
|
#
|
351
360
|
# If timeout is zero of nil, the command will not time out. If the command
|
352
361
|
# times out, it is killed via a SIGKILL signal and `Git::TimeoutError` is raised.
|
353
362
|
#
|
354
363
|
# If the command does not respond to SIGKILL, it will hang this method.
|
355
364
|
#
|
356
|
-
# @raise [Git::
|
365
|
+
# @raise [Git::ProcessIOError] if an exception was raised while collecting subprocess output
|
357
366
|
# @raise [Git::TimeoutError] if the command times out
|
358
367
|
#
|
359
368
|
# @return [Git::CommandLineResult] the result of the command to return to the caller
|