git 5.6.1 → 5.7.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a8ec4da3066f7c301611783c89f0a127f6c8ad4e7cf2467db9fe9071b7e0f943
4
- data.tar.gz: 10fc3f33082886e7ca47e1ea97bd50075ffb15afbb91e1b309d9a12168a590ac
3
+ metadata.gz: a20c2b714fc915052748e7cf91d24aa45c7b65a6e6dfd61bab53ecac6852fba2
4
+ data.tar.gz: 6aa30cf77186f3640ca8429f9e70c406491aa6fde53b86e17510396955334cfc
5
5
  SHA512:
6
- metadata.gz: 91e896c14c04e2135468d70031721cfbb29ba873284160f208315025bacc331a0fefaa04c837467d33b284253a04267ee8f4c003ea564770d619f9365ecb1b73
7
- data.tar.gz: 03c6e84729ce4a4e6809cf53b92a6bcfb48572f1b8724e83cc451e829d1357b93da286e8fd6c669ddce3aa946cb0890237008992b9230e8cf41991e291fb8f76
6
+ metadata.gz: f3534d942286512f6f7c10bb00359a55529f9d6823733e642d4faa720f25ae8fc30bfac69f51974aa37c64d268afa67826befc8cd3c43262137d0226d2bbd15a
7
+ data.tar.gz: 4b4da1ad058003d82334ffe2bea0c6424b348886cd6dceb696b18e2fa68c256d1f818bbc97ea29d7c510bf735423ab93dd9831ce9ff4d07a68b501f5ac21bdf0
data/CHANGELOG.md CHANGED
@@ -5,6 +5,20 @@
5
5
 
6
6
  # Change Log
7
7
 
8
+ ## [5.7.1](https://github.com/ruby-git/ruby-git/compare/v5.7.0...v5.7.1) (2026-10-28)
9
+
10
+
11
+ ### Other Changes
12
+
13
+ * Name the release that starts warning for the renamed aliases ([e5d6537](https://github.com/ruby-git/ruby-git/commit/e5d6537ad65395a6075ee6cb00718c94cd915036)), closes [#1923](https://github.com/ruby-git/ruby-git/issues/1923)
14
+
15
+ ## [5.7.0](https://github.com/ruby-git/ruby-git/compare/v5.6.1...v5.7.0) (2026-10-28)
16
+
17
+
18
+ ### Features
19
+
20
+ * **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)
21
+
8
22
  ## [5.6.1](https://github.com/ruby-git/ruby-git/compare/v5.6.0...v5.6.1) (2026-09-16)
9
23
 
10
24
 
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
+ Releases before v5.7.0 kept the older names as aliases with no warning. From
403
+ v5.7.0 on, each old name emits a deprecation warning. 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](#gitrepository-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.
@@ -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.diff_name_status(@from, @to, path_limiter: @path_limiter).to_h
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
- # Alias for {#diff_path_status}; provided for backward compatibility
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
- # @deprecated Use {#diff_path_status} instead
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
- alias diff_name_status diff_path_status
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}; retained for backward compatibility
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
- # Alias for {#cat_file_contents}
98
+ # Returns the raw contents of a git object (deprecated name for {#cat_file_contents})
98
99
  #
99
- # @deprecated Use {#cat_file_contents} instead
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
- alias object_contents cat_file_contents
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
- # Alias for {#cat_file_size}
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
- alias object_size cat_file_size
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
- # Alias for {#cat_file_type}
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
- alias object_type cat_file_type
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
- # Alias for {#cat_file_commit}
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
- # @deprecated Use {#cat_file_commit} instead
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
- alias commit_data cat_file_commit
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
- # Alias for {#cat_file_tag}
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
- # @deprecated Use {#cat_file_tag} instead
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
- alias tag_data cat_file_tag
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
- alias revparse rev_parse
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
- # Alias for {#name_rev}
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
- # @deprecated Use {#name_rev} instead
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
- alias namerev name_rev
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
@@ -4,7 +4,7 @@ module Git
4
4
  # The current gem version
5
5
  #
6
6
  # @return [String] the current gem version
7
- VERSION = '5.6.1'
7
+ VERSION = '5.7.1'
8
8
 
9
9
  # Represents a git version with major, minor, and patch components
10
10
  #
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.6.1
4
+ version: 5.7.1
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.6.1/file/CHANGELOG.md
552
- documentation_uri: https://rubydoc.info/gems/git/5.6.1
551
+ changelog_uri: https://rubydoc.info/gems/git/5.7.1/file/CHANGELOG.md
552
+ documentation_uri: https://rubydoc.info/gems/git/5.7.1
553
553
  rubygems_mfa_required: 'true'
554
554
  rdoc_options: []
555
555
  require_paths: