git 4.3.1 → 4.3.2

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: ce05faa211be55d9467eb7d8daa65b72f1068cc5b1c5b4144b70fc21b75324dd
4
- data.tar.gz: 8d52ea0fd9b590f162f4ccaef24f6e6504136fe7cfc5b330188c2f6a8f8b125c
3
+ metadata.gz: 317aadaf4169f420466db692337037d90a5a7085dcc84b2b167a9dd5247f369a
4
+ data.tar.gz: 4308bcfb71982891d57cdec3c75d66c640c96788ac924f246df8c0d76a09fbf1
5
5
  SHA512:
6
- metadata.gz: 71b65725f8b3b156c81965861157a192d088d777aac15ca24e6f0b8d39fdb3fd67eb596d423e6423480edfe3861a0646c9907bd11be289f601cce7d1dbd00ca0
7
- data.tar.gz: 3d28b71cb77959e0f01cb6d3b83a39862b461bd4c0e061a9646a0a993785e8f8feea2c614cc4c26ff2271fba8736ce292dc7ccf892188ac1f99c9c91c2fd8bc8
6
+ metadata.gz: 6e0b4a0da59ed13a76d46c68619ce882cdfaf9512b5ed3b1c0da3c57f5a763804cf866e3cd6ec374191d1cf506ab05953e4ad62878d28c771cb746be11cf2d94
7
+ data.tar.gz: a3db0a284e6211bfd9684422748b998df7cb8f21d8654f6a4e399879b7670287bc515bccfd7fdd885219fa39c167b738ab2b6ca694801523f5ffdb58d51d82ac
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "4.3.1"
2
+ ".": "4.3.2"
3
3
  }
data/.rubocop.yml CHANGED
@@ -45,6 +45,10 @@ Style/Documentation:
45
45
  Exclude:
46
46
  - "tests/units/**/*"
47
47
 
48
+ Style/OneClassPerFile:
49
+ Exclude:
50
+ - "tests/units/**/*"
51
+
48
52
  AllCops:
49
53
  # Pin this project to Ruby 3.1 in case the shared config above is upgraded to 3.2
50
54
  # or later.
data/.rubocop_todo.yml CHANGED
@@ -9,4 +9,4 @@
9
9
  # Offense count: 2
10
10
  # Configuration parameters: CountComments, CountAsOne.
11
11
  Metrics/ClassLength:
12
- Max: 1160
12
+ Max: 1170
data/CHANGELOG.md CHANGED
@@ -5,6 +5,19 @@
5
5
 
6
6
  # Change Log
7
7
 
8
+ ## [4.3.2](https://github.com/ruby-git/ruby-git/compare/v4.3.1...v4.3.2) (2026-03-31)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * Return empty result from git log on repo with no commits ([d275b25](https://github.com/ruby-git/ruby-git/commit/d275b25b03201ebaca13a81a75e3295ed85c40c7)), closes [#1155](https://github.com/ruby-git/ruby-git/issues/1155)
14
+
15
+
16
+ ### Other Changes
17
+
18
+ * Add docker-git script to test with specific git versions ([0cc0e80](https://github.com/ruby-git/ruby-git/commit/0cc0e804758e73520c124622a7ba49ff97f2deaf))
19
+ * Address newly reported rubocop offenses ([a37412d](https://github.com/ruby-git/ruby-git/commit/a37412d6a1cf2b927a6173ea767a7ad9f1290af6))
20
+
8
21
  ## [4.3.1](https://github.com/ruby-git/ruby-git/compare/v4.3.0...v4.3.1) (2026-02-20)
9
22
 
10
23
 
@@ -242,7 +242,7 @@ module Git
242
242
  # @api private
243
243
  #
244
244
  def build_git_cmd(args)
245
- raise ArgumentError, 'The args array can not contain an array' if args.any? { |a| a.is_a?(Array) }
245
+ raise ArgumentError, 'The args array can not contain an array' if args.any?(Array)
246
246
 
247
247
  [binary_path, *global_opts, *args].map(&:to_s)
248
248
  end
data/lib/git/diff.rb CHANGED
@@ -133,7 +133,7 @@ module Git
133
133
  private
134
134
 
135
135
  def validate_paths_not_arrays(paths)
136
- return unless paths.any? { |p| p.is_a?(Array) }
136
+ return unless paths.any?(Array)
137
137
 
138
138
  raise ArgumentError,
139
139
  'path expects individual arguments, not arrays. ' \
data/lib/git/lib.rb CHANGED
@@ -289,7 +289,7 @@ module Git
289
289
 
290
290
  arr_opts += log_path_options(opts)
291
291
 
292
- command_lines('log', *arr_opts).map { |l| l.split.first }
292
+ log_or_empty_on_unborn { command_lines('log', *arr_opts).map { |l| l.split.first } }
293
293
  end
294
294
 
295
295
  FULL_LOG_EXTRA_OPTIONS_MAP = [
@@ -360,8 +360,10 @@ module Git
360
360
  args += build_args(opts, FULL_LOG_EXTRA_OPTIONS_MAP)
361
361
  args += log_path_options(opts)
362
362
 
363
- full_log = command_lines('log', *args)
364
- process_commit_log_data(full_log)
363
+ log_or_empty_on_unborn do
364
+ full_log = command_lines('log', *args)
365
+ process_commit_log_data(full_log)
366
+ end
365
367
  end
366
368
 
367
369
  # Verify and resolve a Git revision to its full SHA
@@ -2262,5 +2264,14 @@ module Git
2262
2264
  end
2263
2265
  arr_opts
2264
2266
  end
2267
+
2268
+ def log_or_empty_on_unborn
2269
+ yield
2270
+ rescue Git::FailedError => e
2271
+ raise unless e.result.status.exitstatus == 128 &&
2272
+ e.result.stderr =~ /does not have any commits yet/
2273
+
2274
+ []
2275
+ end
2265
2276
  end
2266
2277
  end
data/lib/git/log.rb CHANGED
@@ -32,7 +32,7 @@ module Git
32
32
  def each(&block) = commits.each(&block)
33
33
  def last = commits.last
34
34
  def [](index) = commits[index]
35
- def to_s = map(&:to_s).join("\n")
35
+ def to_s = commits.join("\n")
36
36
  def size = commits.size
37
37
  end
38
38
 
@@ -117,7 +117,7 @@ module Git
117
117
  'Calling Git::Log#to_s is deprecated. Call #execute and then #to_s on the result object.'
118
118
  )
119
119
  run_log_if_dirty
120
- @commits&.map(&:to_s)&.join("\n")
120
+ @commits&.join("\n")
121
121
  end
122
122
 
123
123
  # @deprecated Use {#execute} and call the method on the result.
data/lib/git/status.rb CHANGED
@@ -80,11 +80,7 @@ module Git
80
80
  rescue Git::FailedError
81
81
  @_ignore_case = false
82
82
  end
83
- end
84
- end
85
83
 
86
- module Git
87
- class Status
88
84
  # Represents a single file's status in the git repository. Each instance
89
85
  # holds information about a file's state in the index and working tree.
90
86
  class StatusFile
@@ -109,11 +105,7 @@ module Git
109
105
  @base.object(sha) if sha
110
106
  end
111
107
  end
112
- end
113
- end
114
108
 
115
- module Git
116
- class Status
117
109
  # A factory class responsible for fetching git status data and building
118
110
  # a hash of StatusFile objects.
119
111
  # @api private
data/lib/git/version.rb CHANGED
@@ -3,5 +3,5 @@
3
3
  module Git
4
4
  # The current gem version
5
5
  # @return [String] the current gem version.
6
- VERSION = '4.3.1'
6
+ VERSION = '4.3.2'
7
7
  end
data/lib/git.rb CHANGED
@@ -43,7 +43,7 @@ require 'git/worktrees'
43
43
  #
44
44
  # @author Scott Chacon (mailto:schacon@gmail.com)
45
45
  #
46
- module Git
46
+ module Git # rubocop:disable Style/OneClassPerFile
47
47
  # g.config('user.name', 'Scott Chacon') # sets value
48
48
  # g.config('user.email', 'email@email.com') # sets value
49
49
  # g.config('user.name') # returns 'Scott Chacon'
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: 4.3.1
4
+ version: 4.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Chacon and others
@@ -310,8 +310,8 @@ licenses:
310
310
  metadata:
311
311
  homepage_uri: http://github.com/ruby-git/ruby-git
312
312
  source_code_uri: http://github.com/ruby-git/ruby-git
313
- changelog_uri: https://rubydoc.info/gems/git/4.3.1/file/CHANGELOG.md
314
- documentation_uri: https://rubydoc.info/gems/git/4.3.1
313
+ changelog_uri: https://rubydoc.info/gems/git/4.3.2/file/CHANGELOG.md
314
+ documentation_uri: https://rubydoc.info/gems/git/4.3.2
315
315
  rubygems_mfa_required: 'true'
316
316
  rdoc_options: []
317
317
  require_paths:
@@ -328,7 +328,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
328
328
  version: '0'
329
329
  requirements:
330
330
  - git 2.28.0 or greater
331
- rubygems_version: 4.0.3
331
+ rubygems_version: 4.0.6
332
332
  specification_version: 4
333
333
  summary: An API to create, read, and manipulate Git repositories
334
334
  test_files: []