git 1.19.1 → 4.4.5

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.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/.commitlintrc.yml +38 -0
  3. data/.github/copilot-instructions.md +2733 -0
  4. data/.github/pull_request_template.md +17 -0
  5. data/.github/workflows/continuous_integration.yml +92 -21
  6. data/.github/workflows/enforce_conventional_commits.yml +29 -0
  7. data/.github/workflows/experimental_continuous_integration.yml +59 -0
  8. data/.github/workflows/release.yml +53 -0
  9. data/.gitignore +5 -0
  10. data/.husky/commit-msg +1 -0
  11. data/.release-please-manifest.json +3 -0
  12. data/.rubocop.yml +55 -0
  13. data/.rubocop_todo.yml +12 -0
  14. data/.yardopts +4 -1
  15. data/AI_POLICY.md +24 -0
  16. data/CHANGELOG.md +501 -0
  17. data/CODE_OF_CONDUCT.md +25 -0
  18. data/CONTRIBUTING.md +323 -102
  19. data/GOVERNANCE.md +106 -0
  20. data/LICENSE +1 -1
  21. data/MAINTAINERS.md +17 -4
  22. data/README.md +575 -246
  23. data/Rakefile +13 -55
  24. data/git.gemspec +36 -30
  25. data/lib/git/args_builder.rb +111 -0
  26. data/lib/git/author.rb +9 -7
  27. data/lib/git/base.rb +602 -173
  28. data/lib/git/branch.rb +318 -38
  29. data/lib/git/branches.rb +21 -24
  30. data/lib/git/command_line.rb +330 -0
  31. data/lib/git/command_line_result.rb +9 -3
  32. data/lib/git/config.rb +10 -6
  33. data/lib/git/diff.rb +149 -81
  34. data/lib/git/diff_path_status.rb +46 -0
  35. data/lib/git/diff_stats.rb +59 -0
  36. data/lib/git/errors.rb +212 -0
  37. data/lib/git/escaped_path.rb +2 -2
  38. data/lib/git/fsck_object.rb +48 -0
  39. data/lib/git/fsck_result.rb +121 -0
  40. data/lib/git/index.rb +2 -1
  41. data/lib/git/lib.rb +1648 -643
  42. data/lib/git/log.rb +143 -106
  43. data/lib/git/object.rb +151 -125
  44. data/lib/git/path.rb +23 -16
  45. data/lib/git/remote.rb +5 -4
  46. data/lib/git/repository.rb +2 -2
  47. data/lib/git/stash.rb +11 -12
  48. data/lib/git/stashes.rb +16 -15
  49. data/lib/git/status.rb +104 -143
  50. data/lib/git/url.rb +3 -3
  51. data/lib/git/version.rb +3 -1
  52. data/lib/git/working_directory.rb +2 -0
  53. data/lib/git/worktree.rb +6 -5
  54. data/lib/git/worktrees.rb +6 -6
  55. data/lib/git.rb +131 -28
  56. data/package.json +10 -0
  57. data/redesign/1_architecture_existing.md +66 -0
  58. data/redesign/2_architecture_redesign.md +130 -0
  59. data/redesign/3_architecture_implementation.md +138 -0
  60. data/redesign/index.md +34 -0
  61. data/release-please-config.json +36 -0
  62. data/tasks/gem_tasks.rake +10 -0
  63. data/tasks/rubocop.rake +12 -0
  64. data/tasks/test.rake +13 -0
  65. data/tasks/test_gem.rake +12 -0
  66. data/tasks/yard.rake +23 -0
  67. metadata +114 -37
  68. data/.github/stale.yml +0 -25
  69. data/Dockerfile.changelog-rs +0 -12
  70. data/PULL_REQUEST_TEMPLATE.md +0 -9
  71. data/RELEASING.md +0 -70
  72. data/lib/git/base/factory.rb +0 -99
  73. data/lib/git/failed_error.rb +0 -53
  74. data/lib/git/git_execute_error.rb +0 -7
  75. data/lib/git/signaled_error.rb +0 -50
  76. /data/{ISSUE_TEMPLATE.md → .github/issue_template.md} +0 -0
metadata CHANGED
@@ -1,15 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.19.1
4
+ version: 4.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Chacon and others
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-01-13 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: activesupport
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '5.0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '5.0'
13
26
  - !ruby/object:Gem::Dependency
14
27
  name: addressable
15
28
  requirement: !ruby/object:Gem::Requirement
@@ -24,118 +37,160 @@ dependencies:
24
37
  - - "~>"
25
38
  - !ruby/object:Gem::Version
26
39
  version: '2.8'
40
+ - !ruby/object:Gem::Dependency
41
+ name: process_executer
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '4.1'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '4.1'
27
54
  - !ruby/object:Gem::Dependency
28
55
  name: rchardet
29
56
  requirement: !ruby/object:Gem::Requirement
30
57
  requirements:
31
58
  - - "~>"
32
59
  - !ruby/object:Gem::Version
33
- version: '1.8'
60
+ version: '1.9'
34
61
  type: :runtime
35
62
  prerelease: false
36
63
  version_requirements: !ruby/object:Gem::Requirement
37
64
  requirements:
38
65
  - - "~>"
39
66
  - !ruby/object:Gem::Version
40
- version: '1.8'
67
+ version: '1.9'
41
68
  - !ruby/object:Gem::Dependency
42
- name: bump
69
+ name: create_github_release
43
70
  requirement: !ruby/object:Gem::Requirement
44
71
  requirements:
45
72
  - - "~>"
46
73
  - !ruby/object:Gem::Version
47
- version: '0.10'
74
+ version: '2.1'
48
75
  type: :development
49
76
  prerelease: false
50
77
  version_requirements: !ruby/object:Gem::Requirement
51
78
  requirements:
52
79
  - - "~>"
53
80
  - !ruby/object:Gem::Version
54
- version: '0.10'
81
+ version: '2.1'
55
82
  - !ruby/object:Gem::Dependency
56
- name: create_github_release
83
+ name: main_branch_shared_rubocop_config
57
84
  requirement: !ruby/object:Gem::Requirement
58
85
  requirements:
59
86
  - - "~>"
60
87
  - !ruby/object:Gem::Version
61
- version: '0.2'
88
+ version: '0.1'
62
89
  type: :development
63
90
  prerelease: false
64
91
  version_requirements: !ruby/object:Gem::Requirement
65
92
  requirements:
66
93
  - - "~>"
67
94
  - !ruby/object:Gem::Version
68
- version: '0.2'
95
+ version: '0.1'
69
96
  - !ruby/object:Gem::Dependency
70
97
  name: minitar
71
98
  requirement: !ruby/object:Gem::Requirement
72
99
  requirements:
73
100
  - - "~>"
74
101
  - !ruby/object:Gem::Version
75
- version: '0.9'
102
+ version: '1.0'
76
103
  type: :development
77
104
  prerelease: false
78
105
  version_requirements: !ruby/object:Gem::Requirement
79
106
  requirements:
80
107
  - - "~>"
81
108
  - !ruby/object:Gem::Version
82
- version: '0.9'
109
+ version: '1.0'
83
110
  - !ruby/object:Gem::Dependency
84
111
  name: mocha
85
112
  requirement: !ruby/object:Gem::Requirement
86
113
  requirements:
87
114
  - - "~>"
88
115
  - !ruby/object:Gem::Version
89
- version: '2.1'
116
+ version: '2.7'
90
117
  type: :development
91
118
  prerelease: false
92
119
  version_requirements: !ruby/object:Gem::Requirement
93
120
  requirements:
94
121
  - - "~>"
95
122
  - !ruby/object:Gem::Version
96
- version: '2.1'
123
+ version: '2.7'
97
124
  - !ruby/object:Gem::Dependency
98
125
  name: rake
99
126
  requirement: !ruby/object:Gem::Requirement
100
127
  requirements:
101
128
  - - "~>"
102
129
  - !ruby/object:Gem::Version
103
- version: '13.0'
130
+ version: '13.2'
131
+ type: :development
132
+ prerelease: false
133
+ version_requirements: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: '13.2'
138
+ - !ruby/object:Gem::Dependency
139
+ name: rubocop
140
+ requirement: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: '1.77'
104
145
  type: :development
105
146
  prerelease: false
106
147
  version_requirements: !ruby/object:Gem::Requirement
107
148
  requirements:
108
149
  - - "~>"
109
150
  - !ruby/object:Gem::Version
110
- version: '13.0'
151
+ version: '1.77'
111
152
  - !ruby/object:Gem::Dependency
112
153
  name: test-unit
113
154
  requirement: !ruby/object:Gem::Requirement
114
155
  requirements:
115
156
  - - "~>"
116
157
  - !ruby/object:Gem::Version
117
- version: '3.3'
158
+ version: '3.6'
159
+ type: :development
160
+ prerelease: false
161
+ version_requirements: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - "~>"
164
+ - !ruby/object:Gem::Version
165
+ version: '3.6'
166
+ - !ruby/object:Gem::Dependency
167
+ name: irb
168
+ requirement: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - "~>"
171
+ - !ruby/object:Gem::Version
172
+ version: '1.6'
118
173
  type: :development
119
174
  prerelease: false
120
175
  version_requirements: !ruby/object:Gem::Requirement
121
176
  requirements:
122
177
  - - "~>"
123
178
  - !ruby/object:Gem::Version
124
- version: '3.3'
179
+ version: '1.6'
125
180
  - !ruby/object:Gem::Dependency
126
181
  name: redcarpet
127
182
  requirement: !ruby/object:Gem::Requirement
128
183
  requirements:
129
184
  - - "~>"
130
185
  - !ruby/object:Gem::Version
131
- version: '3.5'
186
+ version: '3.6'
132
187
  type: :development
133
188
  prerelease: false
134
189
  version_requirements: !ruby/object:Gem::Requirement
135
190
  requirements:
136
191
  - - "~>"
137
192
  - !ruby/object:Gem::Version
138
- version: '3.5'
193
+ version: '3.6'
139
194
  - !ruby/object:Gem::Dependency
140
195
  name: yard
141
196
  requirement: !ruby/object:Gem::Requirement
@@ -181,35 +236,48 @@ executables: []
181
236
  extensions: []
182
237
  extra_rdoc_files: []
183
238
  files:
184
- - ".github/stale.yml"
239
+ - ".commitlintrc.yml"
240
+ - ".github/copilot-instructions.md"
241
+ - ".github/issue_template.md"
242
+ - ".github/pull_request_template.md"
185
243
  - ".github/workflows/continuous_integration.yml"
244
+ - ".github/workflows/enforce_conventional_commits.yml"
245
+ - ".github/workflows/experimental_continuous_integration.yml"
246
+ - ".github/workflows/release.yml"
186
247
  - ".gitignore"
248
+ - ".husky/commit-msg"
249
+ - ".release-please-manifest.json"
250
+ - ".rubocop.yml"
251
+ - ".rubocop_todo.yml"
187
252
  - ".yardopts"
253
+ - AI_POLICY.md
188
254
  - CHANGELOG.md
255
+ - CODE_OF_CONDUCT.md
189
256
  - CONTRIBUTING.md
190
- - Dockerfile.changelog-rs
257
+ - GOVERNANCE.md
191
258
  - Gemfile
192
- - ISSUE_TEMPLATE.md
193
259
  - LICENSE
194
260
  - MAINTAINERS.md
195
- - PULL_REQUEST_TEMPLATE.md
196
261
  - README.md
197
- - RELEASING.md
198
262
  - Rakefile
199
263
  - git.gemspec
200
264
  - lib/git.rb
265
+ - lib/git/args_builder.rb
201
266
  - lib/git/author.rb
202
267
  - lib/git/base.rb
203
- - lib/git/base/factory.rb
204
268
  - lib/git/branch.rb
205
269
  - lib/git/branches.rb
270
+ - lib/git/command_line.rb
206
271
  - lib/git/command_line_result.rb
207
272
  - lib/git/config.rb
208
273
  - lib/git/diff.rb
274
+ - lib/git/diff_path_status.rb
275
+ - lib/git/diff_stats.rb
209
276
  - lib/git/encoding_utils.rb
277
+ - lib/git/errors.rb
210
278
  - lib/git/escaped_path.rb
211
- - lib/git/failed_error.rb
212
- - lib/git/git_execute_error.rb
279
+ - lib/git/fsck_object.rb
280
+ - lib/git/fsck_result.rb
213
281
  - lib/git/index.rb
214
282
  - lib/git/lib.rb
215
283
  - lib/git/log.rb
@@ -217,7 +285,6 @@ files:
217
285
  - lib/git/path.rb
218
286
  - lib/git/remote.rb
219
287
  - lib/git/repository.rb
220
- - lib/git/signaled_error.rb
221
288
  - lib/git/stash.rb
222
289
  - lib/git/stashes.rb
223
290
  - lib/git/status.rb
@@ -226,15 +293,26 @@ files:
226
293
  - lib/git/working_directory.rb
227
294
  - lib/git/worktree.rb
228
295
  - lib/git/worktrees.rb
296
+ - package.json
297
+ - redesign/1_architecture_existing.md
298
+ - redesign/2_architecture_redesign.md
299
+ - redesign/3_architecture_implementation.md
300
+ - redesign/index.md
301
+ - release-please-config.json
302
+ - tasks/gem_tasks.rake
303
+ - tasks/rubocop.rake
304
+ - tasks/test.rake
305
+ - tasks/test_gem.rake
306
+ - tasks/yard.rake
229
307
  homepage: http://github.com/ruby-git/ruby-git
230
308
  licenses:
231
309
  - MIT
232
310
  metadata:
233
311
  homepage_uri: http://github.com/ruby-git/ruby-git
234
312
  source_code_uri: http://github.com/ruby-git/ruby-git
235
- changelog_uri: https://rubydoc.info/gems/git/1.19.1/file/CHANGELOG.md
236
- documentation_uri: https://rubydoc.info/gems/git/1.19.1
237
- post_install_message:
313
+ changelog_uri: https://rubydoc.info/gems/git/4.4.5/file/CHANGELOG.md
314
+ documentation_uri: https://rubydoc.info/gems/git/4.4.5
315
+ rubygems_mfa_required: 'true'
238
316
  rdoc_options: []
239
317
  require_paths:
240
318
  - lib
@@ -242,16 +320,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
242
320
  requirements:
243
321
  - - ">="
244
322
  - !ruby/object:Gem::Version
245
- version: '2.3'
323
+ version: 3.2.0
246
324
  required_rubygems_version: !ruby/object:Gem::Requirement
247
325
  requirements:
248
326
  - - ">="
249
327
  - !ruby/object:Gem::Version
250
328
  version: '0'
251
329
  requirements:
252
- - git 1.6.0.0, or greater
253
- rubygems_version: 3.5.3
254
- signing_key:
330
+ - git 2.28.0 or greater
331
+ rubygems_version: 4.0.16
255
332
  specification_version: 4
256
333
  summary: An API to create, read, and manipulate Git repositories
257
334
  test_files: []
data/.github/stale.yml DELETED
@@ -1,25 +0,0 @@
1
- # Probot: Stale
2
- # https://github.com/probot/stale
3
-
4
- # Number of days of inactivity before an issue becomes stale
5
- daysUntilStale: 60
6
-
7
- # Number of days of inactivity before a stale issue is closed
8
- # Set to false to disable. If disabled, issues still need to be closed
9
- # manually, but will remain marked as stale.
10
- daysUntilClose: false
11
-
12
- # Issues with these labels will never be considered stale
13
- exemptLabels:
14
- - pinned
15
- - security
16
-
17
- # Label to use when marking an issue as stale
18
- staleLabel: stale
19
-
20
- # Comment to post when marking an issue as stale. Set to `false` to disable
21
- markComment: >
22
- A friendly reminder that this issue had no activity for 60 days.
23
-
24
- # Comment to post when closing a stale issue. Set to `false` to disable
25
- closeComment: false
@@ -1,12 +0,0 @@
1
- FROM rust
2
-
3
- # Build the docker image (from this project's root directory):
4
- # docker build --file Dockerfile.changelog-rs --tag changelog-rs .
5
- #
6
- # Use this image to output a changelog (from this project's root directory):
7
- # docker run --rm --volume "$PWD:/worktree" changelog-rs v1.9.1 v1.10.0
8
-
9
- RUN cargo install changelog-rs
10
- WORKDIR /worktree
11
-
12
- ENTRYPOINT ["/usr/local/cargo/bin/changelog-rs", "/worktree"]
@@ -1,9 +0,0 @@
1
- ### Your checklist for this pull request
2
- 🚨Please review the [guidelines for contributing](https://github.com/ruby-git/ruby-git/blob/master/CONTRIBUTING.md) to this repository.
3
-
4
- - [ ] Ensure all commits include DCO sign-off.
5
- - [ ] Ensure that your contributions pass unit testing.
6
- - [ ] Ensure that your contributions contain documentation if applicable.
7
-
8
- ### Description
9
- Please describe your pull request.
data/RELEASING.md DELETED
@@ -1,70 +0,0 @@
1
- <!--
2
- # @markup markdown
3
- # @title Releasing
4
- -->
5
-
6
- # How to release a new git.gem
7
-
8
- Releasing a new version of the `git` gem requires these steps:
9
-
10
- - [How to release a new git.gem](#how-to-release-a-new-gitgem)
11
- - [Install Prerequisites](#install-prerequisites)
12
- - [Prepare the Release](#prepare-the-release)
13
- - [Review and Merge the Release](#review-and-merge-the-release)
14
- - [Build and Release the Gem](#build-and-release-the-gem)
15
-
16
- These instructions use an example where:
17
-
18
- - The default branch is `master`
19
- - The current release version is `1.5.0`
20
- - You want to create a new *minor* release, `1.6.0`
21
-
22
- ## Install Prerequisites
23
-
24
- The following tools need to be installed in order to create the release:
25
-
26
- - [git](https://git-scm.com) is used to interact with the local and remote repositories
27
- - [gh](https://cli.github.com) is used to create the release and PR in GitHub
28
- - [Docker](https://www.docker.com) is used to run the script to create the release notes
29
-
30
- On a Mac, these tools can be installed using [brew](https://brew.sh):
31
-
32
- ```shell
33
- $ brew install git
34
- ...
35
- $ brew install gh
36
- ...
37
- $ brew install --cask docker
38
- ...
39
- $
40
- ```
41
-
42
- ## Prepare the Release
43
-
44
- Bump the version, create release notes, tag the release and create a GitHub release and PR which can be used to review the release.
45
-
46
- Steps:
47
-
48
- - Check out the code with `git clone https://github.com/ruby-git/ruby-git ruby-git-v1.6.0 && cd ruby-git-v1.6.0`
49
- - Install development dependencies using bundle `bundle install`
50
- - Based upon the nature of the changes, decide on the type of release: `major`, `minor`, or `patch` (in this example we will use `minor`)
51
- - Run the release script `bundle exec create-github-release minor`
52
-
53
- ## Review and Merge the Release
54
-
55
- Have the release PR approved and merge the changes into the `master` branch.
56
-
57
- **IMPORTANT** DO NOT merge to the `master` branch using the GitHub UI. Instead use the instructions below.
58
-
59
- Steps:
60
-
61
- - Get the release PR reviewed and approved in GitHub
62
- - Merge the changes with the command `git checkout master && git merge --ff-only v1.6.0 && git push`
63
-
64
- ## Build and Release the Gem
65
-
66
- Build the gem and publish it to [rubygems.org](https://rubygems.org/gems/git)
67
-
68
- Steps:
69
-
70
- - Build and release the gem using rake `bundle exec rake release`
@@ -1,99 +0,0 @@
1
- module Git
2
-
3
- class Base
4
-
5
- module Factory
6
- # @return [Git::Branch] an object for branch_name
7
- def branch(branch_name = self.current_branch)
8
- Git::Branch.new(self, branch_name)
9
- end
10
-
11
- # @return [Git::Branches] a collection of all the branches in the repository.
12
- # Each branch is represented as a {Git::Branch}.
13
- def branches
14
- Git::Branches.new(self)
15
- end
16
-
17
- # returns a Git::Worktree object for dir, commitish
18
- def worktree(dir, commitish = nil)
19
- Git::Worktree.new(self, dir, commitish)
20
- end
21
-
22
- # returns a Git::worktrees object of all the Git::Worktrees
23
- # objects for this repo
24
- def worktrees
25
- Git::Worktrees.new(self)
26
- end
27
-
28
- # @return [Git::Object::Commit] a commit object
29
- def commit_tree(tree = nil, opts = {})
30
- Git::Object::Commit.new(self, self.lib.commit_tree(tree, opts))
31
- end
32
-
33
- # @return [Git::Diff] a Git::Diff object
34
- def diff(objectish = 'HEAD', obj2 = nil)
35
- Git::Diff.new(self, objectish, obj2)
36
- end
37
-
38
- # @return [Git::Object] a Git object
39
- def gblob(objectish)
40
- Git::Object.new(self, objectish, 'blob')
41
- end
42
-
43
- # @return [Git::Object] a Git object
44
- def gcommit(objectish)
45
- Git::Object.new(self, objectish, 'commit')
46
- end
47
-
48
- # @return [Git::Object] a Git object
49
- def gtree(objectish)
50
- Git::Object.new(self, objectish, 'tree')
51
- end
52
-
53
- # @return [Git::Log] a log with the specified number of commits
54
- def log(count = 30)
55
- Git::Log.new(self, count)
56
- end
57
-
58
- # returns a Git::Object of the appropriate type
59
- # you can also call @git.gtree('tree'), but that's
60
- # just for readability. If you call @git.gtree('HEAD') it will
61
- # still return a Git::Object::Commit object.
62
- #
63
- # object calls a factory method that will run a rev-parse
64
- # on the objectish and determine the type of the object and return
65
- # an appropriate object for that type
66
- #
67
- # @return [Git::Object] an instance of the appropriate type of Git::Object
68
- def object(objectish)
69
- Git::Object.new(self, objectish)
70
- end
71
-
72
- # @return [Git::Remote] a remote of the specified name
73
- def remote(remote_name = 'origin')
74
- Git::Remote.new(self, remote_name)
75
- end
76
-
77
- # @return [Git::Status] a status object
78
- def status
79
- Git::Status.new(self)
80
- end
81
-
82
- # @return [Git::Object::Tag] a tag object
83
- def tag(tag_name)
84
- Git::Object.new(self, tag_name, 'tag', true)
85
- end
86
-
87
- # Find as good common ancestors as possible for a merge
88
- # example: g.merge_base('master', 'some_branch', 'some_sha', octopus: true)
89
- #
90
- # @return [Array<Git::Object::Commit>] a collection of common ancestors
91
- def merge_base(*args)
92
- shas = self.lib.merge_base(*args)
93
- shas.map { |sha| gcommit(sha) }
94
- end
95
- end
96
-
97
- end
98
-
99
- end
@@ -1,53 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'git/git_execute_error'
4
-
5
- module Git
6
- # This error is raised when a git command fails
7
- #
8
- # The git command executed, status, stdout, and stderr are available from this
9
- # object. The #message includes the git command, the status of the process, and
10
- # the stderr of the process.
11
- #
12
- # @api public
13
- #
14
- class FailedError < Git::GitExecuteError
15
- # Create a FailedError object
16
- #
17
- # Since this gem redirects stderr to stdout, the stdout of the process is used.
18
- #
19
- # @example
20
- # `exit 1` # set $? appropriately for this example
21
- # result = Git::CommandLineResult.new(%w[git status], $?, 'stdout', 'stderr')
22
- # error = Git::FailedError.new(result)
23
- # error.message #=>
24
- # "[\"git\", \"status\"]\nstatus: pid 89784 exit 1\noutput: \"stdout\""
25
- #
26
- # @param result [Git::CommandLineResult] the result of the git command including
27
- # the git command, status, stdout, and stderr
28
- #
29
- def initialize(result)
30
- super("#{result.git_cmd}\nstatus: #{result.status}\noutput: #{result.stdout.inspect}")
31
- @result = result
32
- end
33
-
34
- # @attribute [r] result
35
- #
36
- # The result of the git command including the git command and its status and output
37
- #
38
- # @example
39
- # `exit 1` # set $? appropriately for this example
40
- # result = Git::CommandLineResult.new(%w[git status], $?, 'stdout', 'stderr')
41
- # error = Git::FailedError.new(result)
42
- # error.result #=>
43
- # #<Git::CommandLineResult:0x00000001046bd488
44
- # @git_cmd=["git", "status"],
45
- # @status=#<Process::Status: pid 89784 exit 1>,
46
- # @stderr="stderr",
47
- # @stdout="stdout">
48
- #
49
- # @return [Git::CommandLineResult]
50
- #
51
- attr_reader :result
52
- end
53
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Git
4
- # This error is raised when a git command fails
5
- #
6
- class GitExecuteError < StandardError; end
7
- end
@@ -1,50 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'git/git_execute_error'
4
-
5
- module Git
6
- # This error is raised when a git command exits because of an uncaught signal
7
- #
8
- # The git command executed, status, stdout, and stderr are available from this
9
- # object. The #message includes the git command, the status of the process, and
10
- # the stderr of the process.
11
- #
12
- # @api public
13
- #
14
- class SignaledError < Git::GitExecuteError
15
- # Create a SignaledError object
16
- #
17
- # @example
18
- # `kill -9 $$` # set $? appropriately for this example
19
- # result = Git::CommandLineResult.new(%w[git status], $?, '', "killed")
20
- # error = Git::SignaledError.new(result)
21
- # error.message #=>
22
- # "[\"git\", \"status\"]\nstatus: pid 88811 SIGKILL (signal 9)\nstderr: \"killed\""
23
- #
24
- # @param result [Git::CommandLineResult] the result of the git command including the git command, status, stdout, and stderr
25
- #
26
- def initialize(result)
27
- super("#{result.git_cmd}\nstatus: #{result.status}\nstderr: #{result.stderr.inspect}")
28
- @result = result
29
- end
30
-
31
- # @attribute [r] result
32
- #
33
- # The result of the git command including the git command, status, and output
34
- #
35
- # @example
36
- # `kill -9 $$` # set $? appropriately for this example
37
- # result = Git::CommandLineResult.new(%w[git status], $?, '', "killed")
38
- # error = Git::SignaledError.new(result)
39
- # error.result #=>
40
- # #<Git::CommandLineResult:0x000000010470f6e8
41
- # @git_cmd=["git", "status"],
42
- # @status=#<Process::Status: pid 88811 SIGKILL (signal 9)>,
43
- # @stderr="killed",
44
- # @stdout="">
45
- #
46
- # @return [Git::CommandLineResult]
47
- #
48
- attr_reader :result
49
- end
50
- end
File without changes