git 5.6.1 → 5.7.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/CHANGELOG.md +7 -0
- data/UPGRADING.md +23 -0
- data/lib/git/diff_path_status.rb +1 -1
- data/lib/git/repository/diffing.rb +31 -3
- data/lib/git/repository/object_operations.rb +170 -20
- data/lib/git/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7c23ed7b58cd8f2297c9291b8a0e1686f294abe6c82bbf8673c3651b65cc635d
|
|
4
|
+
data.tar.gz: dd17a339711522080bdb94827173ce404cc918a434f829c26b73d416bd90e742
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 027eb2ff2a491e56a5d9f42a6b6758fa8b54465c0b0c8f990071aa0d84cdae40f489428353bd777f4638f73958e74fe8f9b62254cb50d1f4ba01ccef17039ac2
|
|
7
|
+
data.tar.gz: a69634e5053eb693c08869740abc71ce69cab965a366593040107b158b64bb83ad42521aedc952ce069031ea1ced7de5a58d127cf091651f479632b057301485
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@
|
|
|
5
5
|
|
|
6
6
|
# Change Log
|
|
7
7
|
|
|
8
|
+
## [5.7.0](https://github.com/ruby-git/ruby-git/compare/v5.6.1...v5.7.0) (2026-10-28)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **repository:** Deprecate the eight renamed facade aliases with warnings that name v6.0.0 ([8339117](https://github.com/ruby-git/ruby-git/commit/8339117e9fff5a1acadea73b4ccd385a5b0f1497)), closes [#1923](https://github.com/ruby-git/ruby-git/issues/1923) [#1924](https://github.com/ruby-git/ruby-git/issues/1924)
|
|
14
|
+
|
|
8
15
|
## [5.6.1](https://github.com/ruby-git/ruby-git/compare/v5.6.0...v5.6.1) (2026-09-16)
|
|
9
16
|
|
|
10
17
|
|
data/UPGRADING.md
CHANGED
|
@@ -17,6 +17,7 @@ to update your code when upgrading from the preceding major version.
|
|
|
17
17
|
- [Deprecated methods](#deprecated-methods)
|
|
18
18
|
- [Facade method renames](#facade-method-renames)
|
|
19
19
|
- [`Git::Repository` method renames](#gitrepository-method-renames)
|
|
20
|
+
- [`Git::Repository` alias renames](#gitrepository-alias-renames)
|
|
20
21
|
- [`Git::Repository` option renames](#gitrepository-option-renames)
|
|
21
22
|
- [v4.x-style configuration methods](#v4x-style-configuration-methods)
|
|
22
23
|
- [`Git` module mixin deprecations](#git-module-mixin-deprecations)
|
|
@@ -395,6 +396,28 @@ replacement returns, except `branches_all`.
|
|
|
395
396
|
| `g.is_branch?(name)` | `g.branch?(name)` |
|
|
396
397
|
| `g.branches_all` | `g.branch_list` — returns `Array<Git::BranchInfo>`; see the return shape change above |
|
|
397
398
|
|
|
399
|
+
#### `Git::Repository` alias renames
|
|
400
|
+
|
|
401
|
+
Eight `Git::Repository` methods have a second, older name carried over from v4.x.
|
|
402
|
+
Earlier v5.x releases kept the older names as aliases with no warning. Later
|
|
403
|
+
v5.x releases emit a deprecation warning for each one. Each old name takes the
|
|
404
|
+
same arguments and returns exactly what its replacement returns.
|
|
405
|
+
|
|
406
|
+
> **`diff_name_status`:** a `:path` option emits its own deprecation warning
|
|
407
|
+
> after the method-name warning. Pass `:path_limiter` instead, as described
|
|
408
|
+
> under "`Git::Repository` option renames" below.
|
|
409
|
+
|
|
410
|
+
| Deprecated call (works in v5.x, removed in v6.0.0) | Replacement |
|
|
411
|
+
|-----------------------------------------------------|-------------|
|
|
412
|
+
| `g.object_contents(object)` | `g.cat_file_contents(object)` |
|
|
413
|
+
| `g.object_size(object)` | `g.cat_file_size(object)` |
|
|
414
|
+
| `g.object_type(object)` | `g.cat_file_type(object)` |
|
|
415
|
+
| `g.commit_data(object)` | `g.cat_file_commit(object)` |
|
|
416
|
+
| `g.tag_data(object)` | `g.cat_file_tag(object)` |
|
|
417
|
+
| `g.revparse(objectish)` | `g.rev_parse(objectish)` |
|
|
418
|
+
| `g.namerev(commit_ish)` | `g.name_rev(commit_ish)` |
|
|
419
|
+
| `g.diff_name_status(from, to, opts)` | `g.diff_path_status(from, to, opts)` |
|
|
420
|
+
|
|
398
421
|
#### `Git::Repository` option renames
|
|
399
422
|
|
|
400
423
|
Five methods accept a v4.x option or positional argument under its old name.
|
data/lib/git/diff_path_status.rb
CHANGED
|
@@ -77,7 +77,7 @@ module Git
|
|
|
77
77
|
# @return [Hash{String => String}] a mapping of file paths to status codes
|
|
78
78
|
#
|
|
79
79
|
def fetch_path_status
|
|
80
|
-
@fetch_path_status ||= @base.
|
|
80
|
+
@fetch_path_status ||= @base.diff_path_status(@from, @to, path_limiter: @path_limiter).to_h
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
# Sets up legacy (base, from, to, path_limiter) instance state
|
|
@@ -373,14 +373,42 @@ module Git
|
|
|
373
373
|
Git::DiffPathStatus.new(Private.extract_name_status_from_raw(result.stdout))
|
|
374
374
|
end
|
|
375
375
|
|
|
376
|
-
#
|
|
376
|
+
# Reports each changed path with its status (deprecated name for {#diff_path_status})
|
|
377
|
+
#
|
|
378
|
+
# @example Report path statuses between HEAD and the working tree
|
|
379
|
+
# repo.diff_name_status.to_h #=> { "lib/foo.rb" => "M" }
|
|
380
|
+
#
|
|
381
|
+
# @param from [String, nil] the first commit or object to compare
|
|
382
|
+
#
|
|
383
|
+
# @param to [String, nil] the second commit or object to compare
|
|
384
|
+
#
|
|
385
|
+
# @param opts [Hash] the options accepted by {#diff_path_status}
|
|
386
|
+
#
|
|
387
|
+
# @option opts [String, Pathname, Array<String, Pathname>, nil] :path_limiter (nil)
|
|
388
|
+
# limit the status report to the given path(s)
|
|
389
|
+
#
|
|
390
|
+
# @option opts [String, Pathname, Array<String, Pathname>, nil] :path (nil)
|
|
391
|
+
# **deprecated** — use `:path_limiter` instead
|
|
377
392
|
#
|
|
378
393
|
# @return [Git::DiffPathStatus] the name-status report for the comparison
|
|
379
394
|
#
|
|
380
|
-
# @
|
|
395
|
+
# @raise [ArgumentError] if unsupported options are provided
|
|
396
|
+
#
|
|
397
|
+
# @raise [ArgumentError] if `from` is `nil` but `to` is not OR if `from` or `to` starts with `"-"`
|
|
398
|
+
#
|
|
399
|
+
# @raise [Git::FailedError] if git exits outside the allowed range (exit code > 2)
|
|
400
|
+
#
|
|
401
|
+
# @deprecated Use {#diff_path_status} instead. Will be removed in v6.0.0.
|
|
381
402
|
#
|
|
382
403
|
# @see #diff_path_status
|
|
383
|
-
|
|
404
|
+
#
|
|
405
|
+
def diff_name_status(from = 'HEAD', to = nil, opts = {})
|
|
406
|
+
Git::Deprecation.warn(
|
|
407
|
+
'Git::Repository#diff_name_status is deprecated and will be removed in v6.0.0. ' \
|
|
408
|
+
'Use Git::Repository#diff_path_status instead.'
|
|
409
|
+
)
|
|
410
|
+
diff_path_status(from, to, opts)
|
|
411
|
+
end
|
|
384
412
|
|
|
385
413
|
# Compares the index and the working directory
|
|
386
414
|
#
|
|
@@ -89,17 +89,57 @@ module Git
|
|
|
89
89
|
end
|
|
90
90
|
end
|
|
91
91
|
|
|
92
|
-
# Alias for {#cat_file_contents};
|
|
92
|
+
# Alias for {#cat_file_contents}; kept as a legacy name and not scheduled
|
|
93
|
+
# for removal
|
|
93
94
|
#
|
|
94
95
|
# @see #cat_file_contents
|
|
95
96
|
alias cat_file cat_file_contents
|
|
96
97
|
|
|
97
|
-
#
|
|
98
|
+
# Returns the raw contents of a git object (deprecated name for {#cat_file_contents})
|
|
98
99
|
#
|
|
99
|
-
# @
|
|
100
|
+
# @overload object_contents(object)
|
|
101
|
+
# Returns the object's raw content as a string
|
|
102
|
+
#
|
|
103
|
+
# @example Read a blob's contents
|
|
104
|
+
# repo.object_contents('HEAD:README.md') #=> "# My Project\n"
|
|
105
|
+
#
|
|
106
|
+
# @param object [String] the object name (SHA, ref, `HEAD`, treeish path, etc.)
|
|
107
|
+
#
|
|
108
|
+
# @return [String] the raw content of the object
|
|
109
|
+
#
|
|
110
|
+
# @overload object_contents(object, &block)
|
|
111
|
+
# Streams the object's raw content to a temporary file and yields it
|
|
112
|
+
#
|
|
113
|
+
# @example Read a large blob without buffering it in memory
|
|
114
|
+
# repo.object_contents('HEAD:large_file.bin') { |f| process(f) }
|
|
115
|
+
#
|
|
116
|
+
# @param object [String] the object name (SHA, ref, `HEAD`, treeish path, etc.)
|
|
117
|
+
#
|
|
118
|
+
# @yield [file] the temporary file containing the streamed content,
|
|
119
|
+
# positioned at the start
|
|
120
|
+
#
|
|
121
|
+
# @yieldparam file [File] readable `IO` object positioned at the beginning
|
|
122
|
+
# of the content
|
|
123
|
+
#
|
|
124
|
+
# @yieldreturn [Object] the value to return from this method
|
|
125
|
+
#
|
|
126
|
+
# @return [Object] the value returned by the block
|
|
127
|
+
#
|
|
128
|
+
# @raise [ArgumentError] if `object` starts with a hyphen
|
|
129
|
+
#
|
|
130
|
+
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
131
|
+
#
|
|
132
|
+
# @deprecated Use {#cat_file_contents} instead. Will be removed in v6.0.0.
|
|
100
133
|
#
|
|
101
134
|
# @see #cat_file_contents
|
|
102
|
-
|
|
135
|
+
#
|
|
136
|
+
def object_contents(object, &)
|
|
137
|
+
Git::Deprecation.warn(
|
|
138
|
+
'Git::Repository#object_contents is deprecated and will be removed in v6.0.0. ' \
|
|
139
|
+
'Use Git::Repository#cat_file_contents instead.'
|
|
140
|
+
)
|
|
141
|
+
cat_file_contents(object, &)
|
|
142
|
+
end
|
|
103
143
|
|
|
104
144
|
# Returns the size of a git object in bytes
|
|
105
145
|
#
|
|
@@ -125,12 +165,30 @@ module Git
|
|
|
125
165
|
Git::Commands::CatFile::Raw.new(@execution_context).call(object, s: true).stdout.chomp.to_i
|
|
126
166
|
end
|
|
127
167
|
|
|
128
|
-
#
|
|
168
|
+
# Returns the size of a git object in bytes (deprecated name for {#cat_file_size})
|
|
169
|
+
#
|
|
170
|
+
# @example Get the size of a commit object
|
|
171
|
+
# repo.object_size('HEAD') #=> 265
|
|
172
|
+
#
|
|
173
|
+
# @param object [String] the object name (SHA, ref, `HEAD`, treeish path, etc.)
|
|
174
|
+
#
|
|
175
|
+
# @return [Integer] the size of the object in bytes
|
|
176
|
+
#
|
|
177
|
+
# @raise [ArgumentError] if `object` starts with a hyphen
|
|
178
|
+
#
|
|
179
|
+
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
129
180
|
#
|
|
130
|
-
# @deprecated Use {#cat_file_size} instead
|
|
181
|
+
# @deprecated Use {#cat_file_size} instead. Will be removed in v6.0.0.
|
|
131
182
|
#
|
|
132
183
|
# @see #cat_file_size
|
|
133
|
-
|
|
184
|
+
#
|
|
185
|
+
def object_size(object)
|
|
186
|
+
Git::Deprecation.warn(
|
|
187
|
+
'Git::Repository#object_size is deprecated and will be removed in v6.0.0. ' \
|
|
188
|
+
'Use Git::Repository#cat_file_size instead.'
|
|
189
|
+
)
|
|
190
|
+
cat_file_size(object)
|
|
191
|
+
end
|
|
134
192
|
|
|
135
193
|
# Returns the type of a git object
|
|
136
194
|
#
|
|
@@ -157,12 +215,30 @@ module Git
|
|
|
157
215
|
Git::Commands::CatFile::Raw.new(@execution_context).call(object, t: true).stdout.chomp
|
|
158
216
|
end
|
|
159
217
|
|
|
160
|
-
#
|
|
218
|
+
# Returns the type of a git object (deprecated name for {#cat_file_type})
|
|
219
|
+
#
|
|
220
|
+
# @example Get the type of HEAD
|
|
221
|
+
# repo.object_type('HEAD') #=> "commit"
|
|
222
|
+
#
|
|
223
|
+
# @param object [String] the object name (SHA, ref, `HEAD`, treeish path, etc.)
|
|
224
|
+
#
|
|
225
|
+
# @return [String] the object type: `"blob"`, `"tree"`, `"commit"`, or `"tag"`
|
|
226
|
+
#
|
|
227
|
+
# @raise [ArgumentError] if `object` starts with a hyphen
|
|
228
|
+
#
|
|
229
|
+
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
161
230
|
#
|
|
162
|
-
# @deprecated Use {#cat_file_type} instead
|
|
231
|
+
# @deprecated Use {#cat_file_type} instead. Will be removed in v6.0.0.
|
|
163
232
|
#
|
|
164
233
|
# @see #cat_file_type
|
|
165
|
-
|
|
234
|
+
#
|
|
235
|
+
def object_type(object)
|
|
236
|
+
Git::Deprecation.warn(
|
|
237
|
+
'Git::Repository#object_type is deprecated and will be removed in v6.0.0. ' \
|
|
238
|
+
'Use Git::Repository#cat_file_type instead.'
|
|
239
|
+
)
|
|
240
|
+
cat_file_type(object)
|
|
241
|
+
end
|
|
166
242
|
|
|
167
243
|
# Returns parsed commit data for the given git object
|
|
168
244
|
#
|
|
@@ -200,12 +276,28 @@ module Git
|
|
|
200
276
|
Git::Parsers::CatFile.parse_commit(result.stdout.split("\n"), object)
|
|
201
277
|
end
|
|
202
278
|
|
|
203
|
-
#
|
|
279
|
+
# Returns parsed commit data for a git object (deprecated name for {#cat_file_commit})
|
|
280
|
+
#
|
|
281
|
+
# @example Get commit data for HEAD
|
|
282
|
+
# repo.commit_data('HEAD')
|
|
283
|
+
#
|
|
284
|
+
# @param object [String] the commit name (SHA, ref, `HEAD`, etc.)
|
|
204
285
|
#
|
|
205
|
-
# @
|
|
286
|
+
# @return [Hash] the parsed commit data; see {#cat_file_commit} for the keys
|
|
287
|
+
#
|
|
288
|
+
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
289
|
+
#
|
|
290
|
+
# @deprecated Use {#cat_file_commit} instead. Will be removed in v6.0.0.
|
|
206
291
|
#
|
|
207
292
|
# @see #cat_file_commit
|
|
208
|
-
|
|
293
|
+
#
|
|
294
|
+
def commit_data(object)
|
|
295
|
+
Git::Deprecation.warn(
|
|
296
|
+
'Git::Repository#commit_data is deprecated and will be removed in v6.0.0. ' \
|
|
297
|
+
'Use Git::Repository#cat_file_commit instead.'
|
|
298
|
+
)
|
|
299
|
+
cat_file_commit(object)
|
|
300
|
+
end
|
|
209
301
|
|
|
210
302
|
# Returns parsed tag data for the given annotated tag object
|
|
211
303
|
#
|
|
@@ -256,12 +348,30 @@ module Git
|
|
|
256
348
|
Git::Parsers::CatFile.parse_tag(tdata, object)
|
|
257
349
|
end
|
|
258
350
|
|
|
259
|
-
#
|
|
351
|
+
# Returns parsed tag data for an annotated tag (deprecated name for {#cat_file_tag})
|
|
352
|
+
#
|
|
353
|
+
# @example Get tag data for an annotated tag
|
|
354
|
+
# repo.tag_data('v1.0.0')
|
|
355
|
+
#
|
|
356
|
+
# @param object [String] the tag name or SHA of the annotated tag object
|
|
260
357
|
#
|
|
261
|
-
# @
|
|
358
|
+
# @return [Hash] the parsed tag data; see {#cat_file_tag} for the keys
|
|
359
|
+
#
|
|
360
|
+
# @raise [ArgumentError] if `object` starts with a hyphen
|
|
361
|
+
#
|
|
362
|
+
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
363
|
+
#
|
|
364
|
+
# @deprecated Use {#cat_file_tag} instead. Will be removed in v6.0.0.
|
|
262
365
|
#
|
|
263
366
|
# @see #cat_file_tag
|
|
264
|
-
|
|
367
|
+
#
|
|
368
|
+
def tag_data(object)
|
|
369
|
+
Git::Deprecation.warn(
|
|
370
|
+
'Git::Repository#tag_data is deprecated and will be removed in v6.0.0. ' \
|
|
371
|
+
'Use Git::Repository#cat_file_tag instead.'
|
|
372
|
+
)
|
|
373
|
+
cat_file_tag(object)
|
|
374
|
+
end
|
|
265
375
|
|
|
266
376
|
# Resolve a revision specifier to its full object ID
|
|
267
377
|
#
|
|
@@ -292,7 +402,29 @@ module Git
|
|
|
292
402
|
Git::Commands::RevParse.new(@execution_context).call(objectish, '--', revs_only: true).stdout
|
|
293
403
|
end
|
|
294
404
|
|
|
295
|
-
|
|
405
|
+
# Resolves a revision specifier to its full object ID (deprecated name for {#rev_parse})
|
|
406
|
+
#
|
|
407
|
+
# @example Resolve HEAD to its SHA
|
|
408
|
+
# repo.revparse('HEAD') #=> "9b9b31e704c0b85ffdd8d2af2ded85170a5af87d"
|
|
409
|
+
#
|
|
410
|
+
# @param objectish [String] the revision specifier to resolve (branch name,
|
|
411
|
+
# tag, abbreviated SHA, refspec, etc.)
|
|
412
|
+
#
|
|
413
|
+
# @return [String] the full object ID of the resolved object
|
|
414
|
+
#
|
|
415
|
+
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
416
|
+
#
|
|
417
|
+
# @deprecated Use {#rev_parse} instead. Will be removed in v6.0.0.
|
|
418
|
+
#
|
|
419
|
+
# @see #rev_parse
|
|
420
|
+
#
|
|
421
|
+
def revparse(objectish)
|
|
422
|
+
Git::Deprecation.warn(
|
|
423
|
+
'Git::Repository#revparse is deprecated and will be removed in v6.0.0. ' \
|
|
424
|
+
'Use Git::Repository#rev_parse instead.'
|
|
425
|
+
)
|
|
426
|
+
rev_parse(objectish)
|
|
427
|
+
end
|
|
296
428
|
|
|
297
429
|
# Returns the SHA of a named tag
|
|
298
430
|
#
|
|
@@ -395,12 +527,30 @@ module Git
|
|
|
395
527
|
Git::Commands::NameRev.new(@execution_context).call(commit_ish).stdout.split[1]
|
|
396
528
|
end
|
|
397
529
|
|
|
398
|
-
#
|
|
530
|
+
# Finds a symbolic name for a commit (deprecated name for {#name_rev})
|
|
531
|
+
#
|
|
532
|
+
# @example Name the current commit
|
|
533
|
+
# repo.namerev('HEAD') #=> "main"
|
|
534
|
+
#
|
|
535
|
+
# @param commit_ish [String] the commit to name (SHA, ref, `HEAD`, etc.)
|
|
536
|
+
#
|
|
537
|
+
# @return [String, nil] the symbolic name, or `nil` if git finds none
|
|
538
|
+
#
|
|
539
|
+
# @raise [ArgumentError] if commit_ish starts with a hyphen
|
|
399
540
|
#
|
|
400
|
-
# @
|
|
541
|
+
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
542
|
+
#
|
|
543
|
+
# @deprecated Use {#name_rev} instead. Will be removed in v6.0.0.
|
|
401
544
|
#
|
|
402
545
|
# @see #name_rev
|
|
403
|
-
|
|
546
|
+
#
|
|
547
|
+
def namerev(commit_ish)
|
|
548
|
+
Git::Deprecation.warn(
|
|
549
|
+
'Git::Repository#namerev is deprecated and will be removed in v6.0.0. ' \
|
|
550
|
+
'Use Git::Repository#name_rev instead.'
|
|
551
|
+
)
|
|
552
|
+
name_rev(commit_ish)
|
|
553
|
+
end
|
|
404
554
|
|
|
405
555
|
# Option keys accepted by {#ls_tree}
|
|
406
556
|
LS_TREE_ALLOWED_OPTS = %i[recursive path].freeze
|
data/lib/git/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: git
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 5.
|
|
4
|
+
version: 5.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Scott Chacon and others
|
|
@@ -548,8 +548,8 @@ licenses:
|
|
|
548
548
|
metadata:
|
|
549
549
|
homepage_uri: http://github.com/ruby-git/ruby-git
|
|
550
550
|
source_code_uri: http://github.com/ruby-git/ruby-git
|
|
551
|
-
changelog_uri: https://rubydoc.info/gems/git/5.
|
|
552
|
-
documentation_uri: https://rubydoc.info/gems/git/5.
|
|
551
|
+
changelog_uri: https://rubydoc.info/gems/git/5.7.0/file/CHANGELOG.md
|
|
552
|
+
documentation_uri: https://rubydoc.info/gems/git/5.7.0
|
|
553
553
|
rubygems_mfa_required: 'true'
|
|
554
554
|
rdoc_options: []
|
|
555
555
|
require_paths:
|