git 4.4.0 → 4.4.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: 98b554ddb65a29cb16fc266ea5466c2919c312f5021729ec3719ded044a53a91
4
- data.tar.gz: c98533fda6126f92b5deba44d7ed38878e537fcbd02508702c5f8d1d99d26355
3
+ metadata.gz: 7a068310fe357011fc394084d24264d30f7130dfea211dfc6a2ba5aff40d4c93
4
+ data.tar.gz: 7bd159311bc13ff18518828bbd9ea43da0435d3d1e13fc0762da69540f163c6a
5
5
  SHA512:
6
- metadata.gz: 529bc860265d31541e62381dd7e551405e74cf494da695e740578d0e9c5409ea9151f823a44ad6d089f74d533787fd02f1ed9ca6030656a82ffb72a1936fbef0
7
- data.tar.gz: 3131c1f4ae9e9fb177d6120a6f460e40ed7e592045718e733f861f4289dc4e6668e04eb8f8ab2c2b8fc73c299327817a89ae66f28369382c7856c2ec3d1853d1
6
+ metadata.gz: c2b616a55aac28d2c32097a2cdd14ee8f435ddba1c611393e053841f60deb3af30fd941673af433966378325a91feb280226bf511e67836b95895dfff2505dd9
7
+ data.tar.gz: 6a3c14186bc35d50905892ac333c0c3a7431199c670eaaa1101b56c60344a3fb01ff3f7ca2b7e35f14a7d4e1bb2701bd55c8a0050c58ebbcb5eafd82c3d0495b
@@ -53,3 +53,68 @@ jobs:
53
53
 
54
54
  - name: Test Gem
55
55
  run: bundle exec rake test:gem
56
+
57
+ # The branch ruleset cannot require the matrix job above directly. A required status
58
+ # check is matched by name, and `build`'s name is a template -- GitHub only expands it
59
+ # into "Ruby 3.2 on ubuntu-latest" and friends when it evaluates the matrix. The
60
+ # job-level `if:` short-circuits before that happens, so a release PR reports one check
61
+ # named literally "Ruby ${{ matrix.ruby }} on ${{ matrix.operating-system }}" and the
62
+ # six expanded names never report at all. Required checks that never report block a PR
63
+ # indefinitely rather than passing, which is what stranded the v5.0.5 release PR on
64
+ # main and the v4.4.1 release PR here.
65
+ #
66
+ # So the ruleset requires this job instead: one stable name, no matrix, no template to
67
+ # expand. It also decouples the required-check list from the matrix, so adding or
68
+ # dropping a Ruby version no longer needs a matching ruleset edit.
69
+ #
70
+ # Unlike main, this branch has no separate lint job: `rake default` runs RuboCop and
71
+ # YARD inside every matrix leg, so this one check covers everything CI does here.
72
+ #
73
+ # This job carries the same release-PR guard as the matrix above, so that a release PR
74
+ # reports it as skipped rather than as a success for specs that never ran. Skipping is
75
+ # safe here and was not safe for `build`: this job's name is a literal string, so the
76
+ # check run exists and reports a skipped conclusion whether or not the job runs, and
77
+ # rulesets treat skipped as passing. A matrix job's name does not exist at all until the
78
+ # matrix is evaluated, which is the whole reason this job exists.
79
+ #
80
+ # `always()` is load-bearing and must stay. Without a status check function a job-level
81
+ # `if:` implies `success()`, so a failing matrix would skip this job -- and a skipped
82
+ # required check counts as passing, meaning a red build would merge. `always()` forces a
83
+ # real verdict on every run that is not a release PR. `!cancelled()` is not a substitute:
84
+ # a cancelled run would then skip the gate, and a skipped conclusion is one rulesets treat
85
+ # as passing -- so a build that never finished would stop blocking the merge.
86
+ #
87
+ # The case below accepts `success` only. `build` and this job now carry the same release-PR
88
+ # guard, so this job runs exactly when `build` ran; a `skipped` result would mean the two
89
+ # guards have drifted apart, and failing closed on it turns that into a loud failure rather
90
+ # than a silent pass.
91
+ #
92
+ # Note that a matrix leg marked `experimental: Yes` carries continue-on-error, and a
93
+ # continue-on-error failure does not fail the job as a whole -- so it does not fail this
94
+ # gate either. That is what `experimental` is for; no leg currently sets it.
95
+ build-complete:
96
+ name: All Specs Passed
97
+
98
+ needs: [build]
99
+
100
+ # Report a verdict on every non-release PR regardless of the matrix result, and skip
101
+ # on release PRs, where the matrix was never meant to run.
102
+ if: >-
103
+ always() &&
104
+ (github.event_name == 'workflow_dispatch' ||
105
+ (github.event_name == 'pull_request' && !startsWith(github.event.pull_request.head.ref, 'release-please--')))
106
+
107
+ runs-on: ubuntu-latest
108
+
109
+ steps:
110
+ - name: Check the result of the build job
111
+ run: |
112
+ case "${{ needs.build.result }}" in
113
+ success)
114
+ echo "build: ${{ needs.build.result }}"
115
+ ;;
116
+ *)
117
+ echo "::error::build: ${{ needs.build.result }}"
118
+ exit 1
119
+ ;;
120
+ esac
@@ -1,3 +1,3 @@
1
1
  {
2
- ".": "4.4.0"
2
+ ".": "4.4.2"
3
3
  }
data/CHANGELOG.md CHANGED
@@ -5,6 +5,26 @@
5
5
 
6
6
  # Change Log
7
7
 
8
+ ## [4.4.2](https://github.com/ruby-git/ruby-git/compare/v4.4.1...v4.4.2) (2026-08-19)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * Run the Git.open bootstrap commands without redirecting stdin ([65de0fe](https://github.com/ruby-git/ruby-git/commit/65de0fe88bca34ad3de366ee9a212653de37fc6d)), closes [#840](https://github.com/ruby-git/ruby-git/issues/840)
14
+
15
+ ## [4.4.1](https://github.com/ruby-git/ruby-git/compare/v4.4.0...v4.4.1) (2026-08-09)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * Pin LC_ALL to a locale that exists on the host platform ([690360e](https://github.com/ruby-git/ruby-git/commit/690360e386bac1dafb7b5bd0adbf10072e834f69)), closes [#1669](https://github.com/ruby-git/ruby-git/issues/1669)
21
+
22
+
23
+ ### Other Changes
24
+
25
+ * Add a matrix-free All Specs Passed gate to 4.x ([5352d6d](https://github.com/ruby-git/ruby-git/commit/5352d6d4edfcb52c544139e265fb3636bc1937b7)), closes [#1675](https://github.com/ruby-git/ruby-git/issues/1675)
26
+ * Skip the All Specs Passed gate on release PRs ([52473b2](https://github.com/ruby-git/ruby-git/commit/52473b21a733499eb274a7b03d53f1a0efbf5c86)), closes [#1675](https://github.com/ruby-git/ruby-git/issues/1675)
27
+
8
28
  ## [4.4.0](https://github.com/ruby-git/ruby-git/compare/v4.3.2...v4.4.0) (2026-07-11)
9
29
 
10
30
 
data/lib/git/base.rb CHANGED
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'logger'
4
- require 'open3'
5
4
 
6
5
  module Git
7
6
  # The main public interface for interacting with Git commands
@@ -41,21 +40,14 @@ module Git
41
40
  end
42
41
 
43
42
  def self.binary_version(binary_path)
44
- result, status = execute_git_version(binary_path)
45
-
46
- raise "Failed to get git version: #{status}\n#{result}" unless status.success?
47
-
48
- parse_version_string(result)
43
+ parse_version_string(execute_git_version(binary_path))
49
44
  end
50
45
 
51
46
  private_class_method def self.execute_git_version(binary_path)
52
- Open3.capture2e(
53
- binary_path,
54
- '-c', 'core.quotePath=true',
55
- '-c', 'color.ui=false',
56
- 'version'
57
- )
58
- rescue Errno::ENOENT
47
+ bootstrap_command_line(binary_path).run('version', merge: true).stdout
48
+ rescue Git::CommandLineError => e
49
+ raise "Failed to get git version: #{e.result.status}\n#{e.result.stdout}"
50
+ rescue Errno::ENOENT, ProcessExecuter::SpawnError
59
51
  raise "Failed to get git version: #{binary_path} not found"
60
52
  end
61
53
 
@@ -98,26 +90,45 @@ module Git
98
90
  def self.root_of_worktree(working_dir)
99
91
  raise ArgumentError, "'#{working_dir}' does not exist" unless Dir.exist?(working_dir)
100
92
 
101
- result, status = execute_rev_parse_toplevel(working_dir)
102
- process_rev_parse_result(result, status, working_dir)
93
+ execute_rev_parse_toplevel(working_dir)
103
94
  end
104
95
 
105
96
  private_class_method def self.execute_rev_parse_toplevel(working_dir)
106
- Open3.capture2e(
107
- Git::Base.config.binary_path,
108
- '-c', 'core.quotePath=true',
109
- '-c', 'color.ui=false',
110
- 'rev-parse', '--show-toplevel',
111
- chdir: File.expand_path(working_dir)
112
- )
113
- rescue Errno::ENOENT
97
+ bootstrap_command_line(Git::Base.config.binary_path).run(
98
+ 'rev-parse', '--show-toplevel', chdir: File.expand_path(working_dir), merge: true, chomp: true
99
+ ).stdout
100
+ rescue Git::CommandLineError
101
+ raise ArgumentError, "'#{working_dir}' is not in a git working tree"
102
+ rescue Errno::ENOENT, ProcessExecuter::SpawnError
114
103
  raise ArgumentError, 'Failed to find the root of the worktree: git binary not found'
115
104
  end
116
105
 
117
- private_class_method def self.process_rev_parse_result(result, status, working_dir)
118
- raise ArgumentError, "'#{working_dir}' is not in a git working tree" unless status.success?
119
-
120
- result.chomp
106
+ # A command line for the git commands that run before a repository is known
107
+ #
108
+ # `Open3` is deliberately not used here. Windows has no fork, so
109
+ # `Process.spawn` implements a redirect of the child's stdin by redirecting
110
+ # the *parent's* stdin and restoring it afterward, which replaces the
111
+ # process's stdin handle. That leaves a console REPL such as irb or pry
112
+ # unable to read input for the rest of the session. `Git::CommandLine`
113
+ # redirects only stdout and stderr, so stdin is never disturbed.
114
+ #
115
+ # @see https://github.com/ruby-git/ruby-git/issues/840 issue 840
116
+ #
117
+ # @param binary_path [String] the path to the git binary to run
118
+ #
119
+ # @return [Git::CommandLine] a command line that runs `binary_path` with
120
+ # `-c core.quotePath=true -c color.ui=false`
121
+ #
122
+ # Those are the options the `Open3` calls this replaced passed, kept as they were
123
+ # so these two commands behave exactly as before. Neither `git version` nor
124
+ # `git rev-parse --show-toplevel` emits colored output, so the remaining `color.*`
125
+ # settings in {Git::Lib}'s `STATIC_GLOBAL_OPTS` are not needed here.
126
+ #
127
+ # @api private
128
+ #
129
+ private_class_method def self.bootstrap_command_line(binary_path)
130
+ Git::CommandLine.new({}, binary_path, ['-c', 'core.quotePath=true', '-c', 'color.ui=false'],
131
+ Logger.new(nil))
121
132
  end
122
133
 
123
134
  # (see Git.open)
data/lib/git/lib.rb CHANGED
@@ -11,7 +11,6 @@ require 'process_executer'
11
11
  require 'stringio'
12
12
  require 'tempfile'
13
13
  require 'zlib'
14
- require 'open3'
15
14
 
16
15
  module Git
17
16
  # Internal git operations
@@ -2075,7 +2074,7 @@ module Git
2075
2074
  # @example Unsetting an environment variable (used by worktree_command_line)
2076
2075
  # env_overrides('GIT_INDEX_FILE' => nil)
2077
2076
  # # => { 'GIT_DIR' => '/path/to/.git', 'GIT_WORK_TREE' => '/path/to/worktree',
2078
- # # 'GIT_INDEX_FILE' => nil, 'GIT_SSH' => <git_ssh_value>, 'LC_ALL' => 'en_US.UTF-8' }
2077
+ # # 'GIT_INDEX_FILE' => nil, 'GIT_SSH' => <git_ssh_value>, 'LC_ALL' => <pinned_locale> }
2079
2078
  # # When passed to Process.spawn, GIT_INDEX_FILE will be unset in the environment
2080
2079
  #
2081
2080
  # @see https://ruby-doc.org/core/Process.html#method-c-spawn Process.spawn
@@ -2088,10 +2087,67 @@ module Git
2088
2087
  'GIT_WORK_TREE' => @git_work_dir,
2089
2088
  'GIT_INDEX_FILE' => @git_index_file,
2090
2089
  'GIT_SSH' => resolved_git_ssh,
2091
- 'LC_ALL' => 'en_US.UTF-8'
2090
+ # Pin the locale so git's behavior does not depend on the user's environment.
2091
+ # Added for issue #753, where a German user's `git branch` output
2092
+ # ("* (HEAD losgelöst bei origin/25.1)") broke branch parsing.
2093
+ #
2094
+ # The pin has two halves, and both are load-bearing here:
2095
+ #
2096
+ # - Messages: keeps git's human-readable text in English. `BRANCH_LINE_REGEXP`
2097
+ # matches the literal English strings "(HEAD detached at ...)" and
2098
+ # "(not a branch)" in `git branch -a` output, which is the exact issue #753
2099
+ # failure mode.
2100
+ # - Ctype: makes git's regex engine match *characters* rather than *bytes*.
2101
+ # Under a C ctype, `grep` and `log --grep` silently return wrong answers —
2102
+ # with exit status zero — for any pattern whose metacharacters span
2103
+ # non-ASCII text.
2104
+ #
2105
+ # So do not "simplify" this to `C`: that yields English messages and a broken
2106
+ # ctype, which is the worst of both. A pinned locale the host does not have
2107
+ # degrades to that same C ctype, which is why each branch below has to name a
2108
+ # locale that actually exists on the platform it applies to:
2109
+ #
2110
+ # - Non-Darwin: `C.UTF-8`. Stock Debian, Ubuntu, and RHEL images generate no
2111
+ # `en_US.UTF-8`, so pinning it there produced exactly the silent breakage
2112
+ # above. (musl ignores the locale name for ctype, so Alpine is UTF-8 either
2113
+ # way.)
2114
+ # - Darwin: `en_US.UTF-8`, which every macOS release ships. `C.UTF-8` did not
2115
+ # arrive until macOS 15, so macOS 11–14 — including Intel Macs that are
2116
+ # hardware-capped below 15 — would break under it. Delete this branch once
2117
+ # macOS 14 and earlier are out of support.
2118
+ #
2119
+ # Windows takes the non-Darwin branch, where the value makes no difference:
2120
+ # Git for Windows folds case and runs PCRE in UTF mode under every value, and
2121
+ # matches bytes for `.` and POSIX classes under every value — measured on git
2122
+ # 2.55.0 against `en_US.UTF-8`, `C.UTF-8`, `C`, and no pin at all.
2123
+ #
2124
+ # RHEL 7 (glibc 2.17) has neither locale and gets a C ctype whatever is pinned.
2125
+ # It is EOL, and there is deliberately no public override for this value.
2126
+ 'LC_ALL' => darwin_platform? ? 'en_US.UTF-8' : 'C.UTF-8'
2092
2127
  }.merge(additional_overrides)
2093
2128
  end
2094
2129
 
2130
+ # Whether this process is running on macOS
2131
+ #
2132
+ # Checks `RUBY_DESCRIPTION` as well as `RUBY_PLATFORM` because JRuby reports
2133
+ # `RUBY_PLATFORM` as `"java"` on every host and records the real platform only in
2134
+ # `RUBY_DESCRIPTION` (as, for example, `"... [arm64-darwin]"`). Testing
2135
+ # `RUBY_PLATFORM` alone would put JRuby on macOS onto the non-Darwin branch, which is
2136
+ # the one platform pairing that branch must not be given. This is the same detection
2137
+ # the test suite uses for Windows, and for the same reason.
2138
+ #
2139
+ # Test the platform plainly rather than sniffing the Darwin version: `RUBY_PLATFORM`
2140
+ # records the version Ruby was *built* against, so a Ruby built on macOS 14 still
2141
+ # reports `darwin23` when run on macOS 15.
2142
+ #
2143
+ # @return [Boolean] true if this process is running on macOS
2144
+ #
2145
+ # @api private
2146
+ #
2147
+ def darwin_platform?
2148
+ RUBY_PLATFORM.include?('darwin') || RUBY_DESCRIPTION.include?('darwin')
2149
+ end
2150
+
2095
2151
  # Resolve the git_ssh value to use for this instance
2096
2152
  #
2097
2153
  # @return [String, nil] the resolved git_ssh value
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.4.0'
6
+ VERSION = '4.4.2'
7
7
  end
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.4.0
4
+ version: 4.4.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.4.0/file/CHANGELOG.md
314
- documentation_uri: https://rubydoc.info/gems/git/4.4.0
313
+ changelog_uri: https://rubydoc.info/gems/git/4.4.2/file/CHANGELOG.md
314
+ documentation_uri: https://rubydoc.info/gems/git/4.4.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.10
331
+ rubygems_version: 4.0.16
332
332
  specification_version: 4
333
333
  summary: An API to create, read, and manipulate Git repositories
334
334
  test_files: []