git 5.0.5 → 5.2.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 +69 -0
- data/CONTRIBUTING.md +209 -164
- data/LICENSE +1 -1
- data/README.md +205 -138
- data/git.gemspec +77 -17
- data/lib/git/command_line/base.rb +1 -2
- data/lib/git/commands/base.rb +1 -1
- data/lib/git/commands/cat_file/raw.rb +8 -7
- data/lib/git/configuring.rb +56 -0
- data/lib/git/log.rb +19 -0
- data/lib/git/repository/branching.rb +79 -5
- data/lib/git/repository/logging.rb +35 -11
- data/lib/git/repository/object_operations.rb +22 -1
- data/lib/git/version.rb +1 -1
- metadata +33 -122
- data/.claude/commands/address-copilot-reviews.md +0 -14
- data/.claude/settings.json +0 -16
- data/.claude/skills +0 -1
- data/.commitlintrc.yml +0 -38
- data/.dockerignore +0 -27
- data/.github/copilot-instructions.md +0 -30
- data/.github/hooks/bin-setup-on-worktree.json +0 -11
- data/.github/hooks/run-bin-setup-once.sh +0 -20
- data/.github/issue_template.md +0 -15
- data/.github/prompts/iteratively-address-copilot-reviews.prompt.md +0 -188
- data/.github/pull_request_template.md +0 -21
- data/.github/skills/breaking-change-analysis/SKILL.md +0 -99
- data/.github/skills/ci-cd-troubleshooting/SKILL.md +0 -264
- data/.github/skills/command-implementation/REFERENCE.md +0 -994
- data/.github/skills/command-implementation/SKILL.md +0 -230
- data/.github/skills/command-test-conventions/SKILL.md +0 -664
- data/.github/skills/command-yard-documentation/SKILL.md +0 -434
- data/.github/skills/dependency-management/SKILL.md +0 -72
- data/.github/skills/development-workflow/SKILL.md +0 -512
- data/.github/skills/facade-implementation/REFERENCE.md +0 -837
- data/.github/skills/facade-implementation/SKILL.md +0 -269
- data/.github/skills/facade-test-conventions/SKILL.md +0 -391
- data/.github/skills/facade-yard-documentation/SKILL.md +0 -435
- data/.github/skills/make-skill-template/SKILL.md +0 -226
- data/.github/skills/pr-readiness-review/SKILL.md +0 -205
- data/.github/skills/project-context/SKILL.md +0 -306
- data/.github/skills/pull-request-review/SKILL.md +0 -168
- data/.github/skills/rebase/SKILL.md +0 -148
- data/.github/skills/refactor-command-to-commandlineresult/SKILL.md +0 -131
- data/.github/skills/release-management/SKILL.md +0 -125
- data/.github/skills/resolve-feedback/SKILL.md +0 -288
- data/.github/skills/review-arguments-dsl/CHECKLIST.md +0 -788
- data/.github/skills/review-arguments-dsl/SKILL.md +0 -214
- data/.github/skills/review-cross-command-consistency/SKILL.md +0 -139
- data/.github/skills/reviewing-skills/SKILL.md +0 -214
- data/.github/skills/rspec-unit-testing-standards/SKILL.md +0 -685
- data/.github/skills/tdd-refactor-step/SKILL.md +0 -236
- data/.github/skills/test-debugging/SKILL.md +0 -161
- data/.github/skills/yard-documentation/SKILL.md +0 -981
- data/.github/skills/yard-documentation/element-rules.md +0 -162
- data/.github/skills-deprecated/README.md +0 -21
- data/.github/skills-deprecated/extract-command-from-lib/SKILL.md +0 -487
- data/.github/skills-deprecated/extract-facade-from-base-lib/KEYWORD_ARG_REMEDIATION.md +0 -22
- data/.github/skills-deprecated/extract-facade-from-base-lib/SKILL.md +0 -600
- data/.github/skills-deprecated/review-backward-compatibility/SKILL.md +0 -275
- data/.github/workflows/continuous_integration.yml +0 -343
- data/.github/workflows/enforce_conventional_commits.yml +0 -35
- data/.github/workflows/experimental_continuous_integration.yml +0 -59
- data/.github/workflows/release.yml +0 -52
- data/.github/workflows/warm_bundler_caches.yml +0 -82
- data/.gitignore +0 -30
- data/.husky/commit-msg +0 -1
- data/.husky/pre-commit +0 -13
- data/.release-please-config.json +0 -36
- data/.release-please-manifest.json +0 -3
- data/.rspec +0 -2
- data/.rubocop.yml +0 -37
- data/.rubocop_todo.yml +0 -30
- data/.yard-lint.yml +0 -75
- data/CLAUDE.md +0 -11
- data/Gemfile +0 -22
- data/Rakefile +0 -41
- data/docker/test/Dockerfile +0 -32
- data/docker/test/docker-compose.yml +0 -0
- data/package.json +0 -10
- data/redesign/1_architecture_existing.md +0 -102
- data/redesign/2_architecture_redesign.md +0 -449
- data/redesign/3_architecture_implementation.md +0 -1623
- data/redesign/Phase 4 - Step A.md +0 -366
- data/redesign/Phase 4 - Step B.md +0 -921
- data/redesign/Phase 4 - Step C.md +0 -833
- data/redesign/beta_release.md +0 -107
- data/redesign/branch_parse_refactor_plan.md +0 -163
- data/redesign/c1a-public-api-scope.tsv +0 -256
- data/redesign/c1c2_audit.md +0 -566
- data/redesign/c1c2_bucket6_lib_orphans.md +0 -626
- data/redesign/config_design.rb +0 -501
- data/redesign/index.md +0 -34
- data/redesign/info_object_migration_plan.md +0 -126
- data/redesign/integration_test_analysis.md +0 -521
- data/redesign/phase-4-step-b-test-audit.tsv +0 -485
- data/redesign/remote_refactor_plan.md +0 -164
- data/redesign/reverse_dependencies.sql +0 -44
- data/tasks/gem_tasks.rake +0 -14
- data/tasks/npm_tasks.rake +0 -7
- data/tasks/rspec.rake +0 -111
- data/tasks/rubocop.rake +0 -5
- data/tasks/test_gem.rake +0 -12
- data/tasks/yard.rake +0 -57
data/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
The MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2008 Scott Chacon
|
|
3
|
+
Copyright (c) 2008 Scott Chacon, 2020 James Couball, and the ruby-git contributors
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# @title README
|
|
4
4
|
-->
|
|
5
5
|
|
|
6
|
-
# The
|
|
6
|
+
# The git gem
|
|
7
7
|
|
|
8
8
|
[](https://badge.fury.io/rb/git)
|
|
9
9
|
[](https://github.com/ruby-git/ruby-git/actions/workflows/continuous_integration.yml)
|
|
@@ -22,31 +22,34 @@ Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-%23FE5196?log
|
|
|
22
22
|
|
|
23
23
|
- [Summary](#summary)
|
|
24
24
|
- [Install](#install)
|
|
25
|
-
- [Quick
|
|
25
|
+
- [Quick start](#quick-start)
|
|
26
26
|
- [Examples](#examples)
|
|
27
|
-
- [Gem
|
|
28
|
-
- [Git
|
|
27
|
+
- [Gem configuration](#gem-configuration)
|
|
28
|
+
- [Git configuration](#git-configuration)
|
|
29
29
|
- [Full API](#full-api)
|
|
30
|
-
- [Errors
|
|
31
|
-
- [Specifying and
|
|
30
|
+
- [Errors raised by this gem](#errors-raised-by-this-gem)
|
|
31
|
+
- [Specifying and handling timeouts](#specifying-and-handling-timeouts)
|
|
32
32
|
- [Deprecations](#deprecations)
|
|
33
|
-
- [
|
|
34
|
-
- [
|
|
35
|
-
|
|
36
|
-
- [
|
|
37
|
-
- [
|
|
38
|
-
|
|
39
|
-
- [
|
|
40
|
-
- [
|
|
41
|
-
- [
|
|
42
|
-
- [2025-
|
|
33
|
+
- [Platform limitations](#platform-limitations)
|
|
34
|
+
- [Regex metacharacters on Git for Windows](#regex-metacharacters-on-git-for-windows)
|
|
35
|
+
- [Project policies](#project-policies)
|
|
36
|
+
- [Ruby version support policy](#ruby-version-support-policy)
|
|
37
|
+
- [Git version support policy](#git-version-support-policy)
|
|
38
|
+
- [Project announcements](#project-announcements)
|
|
39
|
+
- [2026-08-23: v5.x deprecations and the v6.0.0 roadmap](#2026-08-23-v5x-deprecations-and-the-v600-roadmap)
|
|
40
|
+
- [2026-07-28: v5.0.0 released](#2026-07-28-v500-released)
|
|
41
|
+
- [2026-01-07: AI policy introduced](#2026-01-07-ai-policy-introduced)
|
|
42
|
+
- [2025-07-09: Architectural redesign](#2025-07-09-architectural-redesign)
|
|
43
|
+
- [2025-07-07: We now use RuboCop](#2025-07-07-we-now-use-rubocop)
|
|
44
|
+
- [2025-06-06: Default branch rename](#2025-06-06-default-branch-rename)
|
|
45
|
+
- [2025-05-15: We've switched to Conventional Commits](#2025-05-15-weve-switched-to-conventional-commits)
|
|
43
46
|
|
|
44
47
|
## Summary
|
|
45
48
|
|
|
46
49
|
The [git gem](https://rubygems.org/gems/git) provides a Ruby interface to the `git`
|
|
47
50
|
command line.
|
|
48
51
|
|
|
49
|
-
Get
|
|
52
|
+
Get a repository object by:
|
|
50
53
|
|
|
51
54
|
- opening an existing working copy with
|
|
52
55
|
[Git.open](https://rubydoc.info/gems/git/Git#open-class_method)
|
|
@@ -55,14 +58,14 @@ Get started by obtaining a repository object by:
|
|
|
55
58
|
- cloning a repository with
|
|
56
59
|
[Git.clone](https://rubydoc.info/gems/git/Git#clone-class_method)
|
|
57
60
|
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
[Git::Repository](https://rubydoc.info/gems/git/Git/Repository) documents the
|
|
62
|
+
methods you can call on a repository object.
|
|
60
63
|
|
|
61
64
|
## Install
|
|
62
65
|
|
|
63
66
|
This gem is a wrapper around the `git` command line, so a `git` executable (version
|
|
64
|
-
2.28.0 or greater) must be installed and on your `PATH`. See the [Git
|
|
65
|
-
|
|
67
|
+
2.28.0 or greater) must be installed and on your `PATH`. See the [Git version support
|
|
68
|
+
policy](#git-version-support-policy) for details.
|
|
66
69
|
|
|
67
70
|
Install the gem and add to the application's Gemfile by executing:
|
|
68
71
|
|
|
@@ -70,21 +73,21 @@ Install the gem and add to the application's Gemfile by executing:
|
|
|
70
73
|
bundle add git
|
|
71
74
|
```
|
|
72
75
|
|
|
73
|
-
If
|
|
76
|
+
If you are not using bundler to manage dependencies, install the gem by executing:
|
|
74
77
|
|
|
75
78
|
```shell
|
|
76
79
|
gem install git
|
|
77
80
|
```
|
|
78
81
|
|
|
79
|
-
## Quick
|
|
82
|
+
## Quick start
|
|
80
83
|
|
|
81
84
|
All functionality for this gem starts with the top-level
|
|
82
|
-
[`Git`](https://rubydoc.info/gems/git/Git) module.
|
|
83
|
-
|
|
85
|
+
[`Git`](https://rubydoc.info/gems/git/Git) module. Use this module to run non-repo
|
|
86
|
+
scoped `git` commands such as `config`.
|
|
84
87
|
|
|
85
88
|
The `Git` module also has factory methods such as `open`, `clone`, and `init` which
|
|
86
|
-
return a [`Git::Repository`](https://rubydoc.info/gems/git/Git/Repository) object.
|
|
87
|
-
`Git::Repository` object
|
|
89
|
+
return a [`Git::Repository`](https://rubydoc.info/gems/git/Git/Repository) object. Use
|
|
90
|
+
the `Git::Repository` object to run repo-specific `git` commands such as `add`,
|
|
88
91
|
`commit`, `push`, and `log`.
|
|
89
92
|
|
|
90
93
|
Clone, read status, and log:
|
|
@@ -123,7 +126,7 @@ repo.commit('initial commit')
|
|
|
123
126
|
These examples cover configuring the gem and git itself. For the full set of
|
|
124
127
|
repository operations, see [Full API](#full-api) below.
|
|
125
128
|
|
|
126
|
-
### Gem
|
|
129
|
+
### Gem configuration
|
|
127
130
|
|
|
128
131
|
Configure the git gem:
|
|
129
132
|
|
|
@@ -139,7 +142,7 @@ Git.config.binary_path = '/usr/local/bin/git'
|
|
|
139
142
|
Git.config.git_ssh = 'ssh -i ~/.ssh/id_rsa'
|
|
140
143
|
```
|
|
141
144
|
|
|
142
|
-
|
|
145
|
+
How SSH configuration is determined:
|
|
143
146
|
|
|
144
147
|
- If `git_ssh` is not specified in the API call, the global config (`Git.configure {
|
|
145
148
|
|c| c.git_ssh = ... }`) is used.
|
|
@@ -165,7 +168,7 @@ git = Git.init('new-repo', git_ssh: 'ssh -i /path/to/private_key')
|
|
|
165
168
|
This is especially useful in multi-threaded applications where different repositories
|
|
166
169
|
require different SSH credentials.
|
|
167
170
|
|
|
168
|
-
### Git
|
|
171
|
+
### Git configuration
|
|
169
172
|
|
|
170
173
|
Read and set `git` configuration values (via `git config`):
|
|
171
174
|
|
|
@@ -186,21 +189,21 @@ repo.config_set('user.email', 'anotheruser@example.com')
|
|
|
186
189
|
|
|
187
190
|
### Full API
|
|
188
191
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
`Git::
|
|
195
|
-
|
|
192
|
+
The quick start and the configuration sections above cover the most common setup.
|
|
193
|
+
The [`Git::Repository`](https://rubydoc.info/gems/git/Git/Repository) reference
|
|
194
|
+
covers everything else: reading history, diffs, branches, remotes, worktrees,
|
|
195
|
+
staging, and low-level index and tree work. It documents every method and the object
|
|
196
|
+
type each one returns (such as `Git::Log`, `Git::Object::Commit`, `Git::Diff`,
|
|
197
|
+
`Git::Branch`, and `Git::Worktree`), so you can follow the links from a method to
|
|
198
|
+
the full API of its result.
|
|
196
199
|
|
|
197
|
-
## Errors
|
|
200
|
+
## Errors raised by this gem
|
|
198
201
|
|
|
199
|
-
The git gem
|
|
200
|
-
|
|
202
|
+
The git gem raises only `ArgumentError` or errors that subclass `Git::Error`. It
|
|
203
|
+
does not explicitly raise any other types of errors.
|
|
201
204
|
|
|
202
|
-
|
|
203
|
-
|
|
205
|
+
Rescue `Git::Error` to catch any runtime error raised by this gem, unless you need
|
|
206
|
+
more specific error handling.
|
|
204
207
|
|
|
205
208
|
```ruby
|
|
206
209
|
begin
|
|
@@ -212,27 +215,25 @@ end
|
|
|
212
215
|
|
|
213
216
|
See [`Git::Error`](https://rubydoc.info/gems/git/Git/Error) for more information.
|
|
214
217
|
|
|
215
|
-
## Specifying and
|
|
218
|
+
## Specifying and handling timeouts
|
|
216
219
|
|
|
217
|
-
|
|
218
|
-
|
|
220
|
+
Set a timeout for git command line operations either globally or per method call for
|
|
221
|
+
methods that accept a `:timeout` parameter.
|
|
219
222
|
|
|
220
|
-
The timeout value must be a real, non-negative `Numeric` value that specifies
|
|
221
|
-
number of seconds a `git` command
|
|
222
|
-
signal. This library may hang if the `git` command does not terminate after
|
|
223
|
-
the KILL signal.
|
|
223
|
+
The timeout value must be a real, non-negative `Numeric` value that specifies the
|
|
224
|
+
number of seconds a `git` command is given to complete before being sent a KILL
|
|
225
|
+
signal. This library may hang if the `git` command does not terminate after
|
|
226
|
+
receiving the KILL signal.
|
|
224
227
|
|
|
225
|
-
When a command times out,
|
|
226
|
-
`Git::TimeoutError
|
|
227
|
-
`Git::Error`.
|
|
228
|
+
When a command times out, the gem kills it with the `SIGKILL` signal and raises a
|
|
229
|
+
`Git::TimeoutError`. This error derives from `Git::SignaledError` and `Git::Error`.
|
|
228
230
|
|
|
229
|
-
If the timeout value is `0` or `nil`, no timeout
|
|
231
|
+
If the timeout value is `0` or `nil`, no timeout is enforced.
|
|
230
232
|
|
|
231
|
-
If a method accepts a `:timeout` parameter and
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
value is.
|
|
233
|
+
If a method accepts a `:timeout` parameter and receives a non-nil value, that value
|
|
234
|
+
overrides the global timeout. In this context, a value of `nil`, which is usually
|
|
235
|
+
the default, uses the global timeout value, and a value of `0` turns off timeout
|
|
236
|
+
enforcement for that method call no matter what the global value is.
|
|
236
237
|
|
|
237
238
|
To set a global timeout, use the `Git.config` object:
|
|
238
239
|
|
|
@@ -252,7 +253,7 @@ Git.clone(repo_url, timeout: 0) # Do not enforce a timeout
|
|
|
252
253
|
Git.clone(repo_url, timeout: 10.5) # Timeout after 10.5 seconds raising Git::TimeoutError
|
|
253
254
|
```
|
|
254
255
|
|
|
255
|
-
If the command takes too long,
|
|
256
|
+
If the command takes too long, the gem raises `Git::TimeoutError`:
|
|
256
257
|
|
|
257
258
|
```ruby
|
|
258
259
|
begin
|
|
@@ -295,14 +296,80 @@ See [the Active Support Deprecation
|
|
|
295
296
|
documentation](https://api.rubyonrails.org/classes/ActiveSupport/Deprecation.html)
|
|
296
297
|
for more details.
|
|
297
298
|
|
|
298
|
-
If deprecation warnings
|
|
299
|
-
|
|
300
|
-
|
|
299
|
+
If you silence deprecation warnings, reenable them before upgrading the git gem to
|
|
300
|
+
the next major version. This makes it easier to identify changes needed for the
|
|
301
|
+
upgrade.
|
|
301
302
|
|
|
302
303
|
For the full list of deprecated methods and their replacements, see
|
|
303
304
|
[UPGRADING.md](UPGRADING.md).
|
|
304
305
|
|
|
305
|
-
##
|
|
306
|
+
## Platform limitations
|
|
307
|
+
|
|
308
|
+
### Regex metacharacters on Git for Windows
|
|
309
|
+
|
|
310
|
+
On Git for Windows, git's regex engine matches **bytes** rather than characters. A
|
|
311
|
+
metacharacter such as `.`, or a POSIX character class such as `[[:alpha:]]`, therefore
|
|
312
|
+
never matches a whole multi-byte character. The same call matches on Linux and macOS.
|
|
313
|
+
|
|
314
|
+
The failure is silent. Nothing raises, and the result is indistinguishable from a
|
|
315
|
+
pattern that genuinely does not occur:
|
|
316
|
+
|
|
317
|
+
```ruby
|
|
318
|
+
# File content, commit message, and config value are all 'ÄPFEL sind gut'.
|
|
319
|
+
# 'Ä' is two bytes in UTF-8 (C3 84), so '.' has to match both to match the character.
|
|
320
|
+
|
|
321
|
+
repo.grep('^.PFEL') # => {} on Windows, matches elsewhere
|
|
322
|
+
repo.log.grep('^.PFEL').execute.size # => 0 on Windows, 1 elsewhere
|
|
323
|
+
repo.config_get_all('test.desc', '^.PFEL') # => [] on Windows, matches elsewhere
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
This is a property of the regex engine git bundles on that platform, not something the
|
|
327
|
+
gem sets. It is unaffected by the locale: the behavior is identical under `en_US.UTF-8`,
|
|
328
|
+
`C.UTF-8`, `C`, and with no `LC_ALL` set at all. Literal (metacharacter-free) patterns
|
|
329
|
+
and case-insensitive matching are unaffected on every platform.
|
|
330
|
+
|
|
331
|
+
**Workaround.** Perl-compatible regular expressions do match characters on Git for
|
|
332
|
+
Windows, so the surfaces that can reach a PCRE engine accept an opt-in selector:
|
|
333
|
+
|
|
334
|
+
```ruby
|
|
335
|
+
repo.grep('^.PFEL', nil, perl_regexp: true) # matches on every platform
|
|
336
|
+
repo.log.perl_regexp.grep('^.PFEL').execute # matches on every platform
|
|
337
|
+
repo.full_log_commits(grep: '^.PFEL', perl_regexp: true)
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
Two caveats:
|
|
341
|
+
|
|
342
|
+
- **PCRE is a different dialect.** Git's other modes are POSIX basic regular
|
|
343
|
+
expressions (the default) and POSIX extended regular expressions (selected
|
|
344
|
+
explicitly). Selecting PCRE is a deliberate choice by the caller, so the gem does
|
|
345
|
+
not substitute it automatically based on the host.
|
|
346
|
+
- **PCRE must be compiled in.** Git for Windows and the mainstream Linux and macOS
|
|
347
|
+
packages ship it, but git built without `USE_LIBPCRE` fails with `cannot use
|
|
348
|
+
Perl-compatible regexes...`.
|
|
349
|
+
|
|
350
|
+
**There is no workaround for `git config` value patterns.** They are POSIX extended
|
|
351
|
+
regular expressions with no PCRE mode, so `config_get`, `config_get_all`,
|
|
352
|
+
`config_get_regexp`, `config_replace_all`, `config_unset`, and `config_unset_all` cannot
|
|
353
|
+
match a metacharacter against a non-ASCII character on Git for Windows. Match on ASCII
|
|
354
|
+
text or an exact value instead.
|
|
355
|
+
|
|
356
|
+
`config_replace_all` deserves particular care, because there the failure is worse than
|
|
357
|
+
an empty result. When the value pattern selects nothing, `git config --replace-all`
|
|
358
|
+
*adds* the new value as an additional entry rather than replacing one, and exits zero:
|
|
359
|
+
|
|
360
|
+
```ruby
|
|
361
|
+
# Existing value of test.desc is 'ÄPFEL sind gut'
|
|
362
|
+
repo.config_replace_all('test.desc', 'NEW', '^.PFEL')
|
|
363
|
+
|
|
364
|
+
repo.config_get_all('test.desc').map(&:value)
|
|
365
|
+
# => ["NEW"] elsewhere, replaced as intended
|
|
366
|
+
# => ["ÄPFEL sind gut", "NEW"] on Windows, original kept and duplicate added
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
So a replace can silently leave the original value in place and add a second entry beside
|
|
370
|
+
it. Confirm with `config_get_all` when the key must end up single-valued.
|
|
371
|
+
|
|
372
|
+
## Project policies
|
|
306
373
|
|
|
307
374
|
These documents set expectations for behavior, contribution workflows, AI-assisted
|
|
308
375
|
changes, decision making, maintainer roles, and licensing. Please review them before
|
|
@@ -319,7 +386,7 @@ opening issues or pull requests.
|
|
|
319
386
|
| [MAINTAINERS](MAINTAINERS.md) | Lists active maintainers (Project Lead noted) and emeritus alumni with links; see governance for role scope. |
|
|
320
387
|
| [LICENSE](LICENSE) | MIT License terms for using, modifying, and redistributing this project. |
|
|
321
388
|
|
|
322
|
-
### Ruby
|
|
389
|
+
### Ruby version support policy
|
|
323
390
|
|
|
324
391
|
This gem is expected to function correctly on:
|
|
325
392
|
|
|
@@ -328,18 +395,18 @@ This gem is expected to function correctly on:
|
|
|
328
395
|
- The latest version of JRuby 9.4+ on Linux
|
|
329
396
|
- The latest version of TruffleRuby 24+ on Linux
|
|
330
397
|
|
|
331
|
-
|
|
398
|
+
This project intends to support the latest version of JRuby on Windows once
|
|
332
399
|
the [process_executer](https://github.com/main-branch/process_executer) gem properly
|
|
333
400
|
supports subprocess status reporting on JRuby for Windows (see
|
|
334
401
|
[main-branch/process_executer#156](https://github.com/main-branch/process_executer/issues/156)).
|
|
335
402
|
|
|
336
|
-
### Git
|
|
403
|
+
### Git version support policy
|
|
337
404
|
|
|
338
405
|
This gem requires git version 2.28.0 or greater as specified in the gemspec. This
|
|
339
406
|
requirement reflects:
|
|
340
407
|
|
|
341
408
|
- The minimum git version necessary to support all features provided by this gem
|
|
342
|
-
- A reasonable balance between supporting older systems and
|
|
409
|
+
- A reasonable balance between supporting older systems and using modern git
|
|
343
410
|
capabilities
|
|
344
411
|
- The practical limitations of testing across multiple git versions in CI
|
|
345
412
|
|
|
@@ -349,16 +416,31 @@ guaranteed. Users on older git versions should upgrade to at least 2.28.0.
|
|
|
349
416
|
|
|
350
417
|
The supported git version may be increased in future major or minor releases of this
|
|
351
418
|
gem as new git features are adopted or as maintaining backward compatibility becomes
|
|
352
|
-
impractical. Such changes will be
|
|
353
|
-
|
|
419
|
+
impractical. Such changes will be documented in the CHANGELOG and release notes.
|
|
420
|
+
|
|
421
|
+
## Project announcements
|
|
422
|
+
|
|
423
|
+
### 2026-08-23: v5.x deprecations and the v6.0.0 roadmap
|
|
354
424
|
|
|
355
|
-
|
|
425
|
+
The road to v6.0.0 is now planned and public. The remaining ActiveRecord-style
|
|
426
|
+
classes (`Git::Branch`, `Git::Remote`, `Git::Stash`, `Git::Worktree`,
|
|
427
|
+
`Git::Object::Tag`, `Git::Status`, `Git::Author`, and their collections) will be
|
|
428
|
+
deprecated during the v5.x series in favor of the immutable `*Info` value-object
|
|
429
|
+
APIs. v6.0.0 will remove each deprecated class that passes the project's removal
|
|
430
|
+
gate: a mandated deprecation soak period plus a proven-safe check. Any class that
|
|
431
|
+
does not pass carries forward, still deprecated. v6.0.0 also raises the version
|
|
432
|
+
floors: git ≥ 2.42.0, Ruby ≥ 3.4.
|
|
356
433
|
|
|
357
|
-
|
|
434
|
+
[Issue #1717](https://github.com/ruby-git/ruby-git/issues/1717) is the living
|
|
435
|
+
roadmap, tracking scope, sequencing, and status. If your code uses the classes
|
|
436
|
+
above, you can start migrating now. Each deprecation names its replacement, and
|
|
437
|
+
[UPGRADING.md](UPGRADING.md) carries the migration guide as releases ship.
|
|
358
438
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
439
|
+
### 2026-07-28: v5.0.0 released
|
|
440
|
+
|
|
441
|
+
We have published [`git v5.0.0`](https://rubygems.org/gems/git/versions/5.0.0), the
|
|
442
|
+
first stable release of the v5.x series, after five public beta releases in June and
|
|
443
|
+
July 2026.
|
|
362
444
|
|
|
363
445
|
**v5.0.0 is a major release with breaking changes.** See
|
|
364
446
|
[UPGRADING.md](UPGRADING.md) for the complete migration guide.
|
|
@@ -375,100 +457,85 @@ Or:
|
|
|
375
457
|
gem install git
|
|
376
458
|
```
|
|
377
459
|
|
|
378
|
-
Most v4.x code requires
|
|
379
|
-
|
|
380
|
-
v6.0.0.
|
|
460
|
+
Most v4.x code requires no changes. Compatibility shims keep the old API working
|
|
461
|
+
while emitting deprecation warnings that tell you what to migrate before v6.0.0.
|
|
381
462
|
|
|
382
|
-
### 2026-01-07: AI
|
|
463
|
+
### 2026-01-07: AI policy introduced
|
|
383
464
|
|
|
384
465
|
We have adopted a formal [AI Policy](AI_POLICY.md) to clarify expectations for
|
|
385
466
|
AI-assisted contributions. Please review it before opening a PR to ensure your
|
|
386
467
|
changes are fully understood, meet our quality bar, and respect licensing
|
|
387
468
|
requirements.
|
|
388
469
|
|
|
389
|
-
We chose a principles-based policy to respect contributors
|
|
390
|
-
quick to read
|
|
391
|
-
setting clear expectations.
|
|
392
|
-
|
|
393
|
-
### 2025-07-09: Architectural Redesign
|
|
394
|
-
|
|
395
|
-
The git gem is undergoing a significant architectural redesign for the upcoming
|
|
396
|
-
v5.0.0 release. The current architecture has several design challenges that make it
|
|
397
|
-
difficult to maintain and evolve. This redesign aims to address these issues by
|
|
398
|
-
introducing a clearer, more robust, and more testable structure.
|
|
470
|
+
We chose a principles-based policy to respect contributors' time and expertise. It
|
|
471
|
+
is quick to read and easy to remember, and it still sets clear expectations.
|
|
399
472
|
|
|
400
|
-
|
|
401
|
-
architecture and the proposed changes. We encourage our community and contributors to
|
|
402
|
-
review them:
|
|
473
|
+
### 2025-07-09: Architectural redesign
|
|
403
474
|
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
3. [Implementation Plan](redesign/3_architecture_implementation.md): The step-by-step
|
|
409
|
-
plan for implementing the redesign.
|
|
475
|
+
On this date we announced an architectural redesign of the git gem. The architecture
|
|
476
|
+
at the time was difficult to maintain and evolve; the redesign replaced it with a
|
|
477
|
+
clearer, more testable three-layer structure of commands, parsers, and a
|
|
478
|
+
`Git::Repository` facade.
|
|
410
479
|
|
|
411
|
-
|
|
412
|
-
|
|
480
|
+
**The redesign shipped in v5.0.0 and is complete.** `Git::Base` and `Git::Lib` are
|
|
481
|
+
gone, along with the `g.lib` accessor. See [UPGRADING.md](UPGRADING.md) for what
|
|
482
|
+
changed and how to migrate.
|
|
413
483
|
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
documented methods like `g.commit`, `g.add`, and `g.status` should find the
|
|
419
|
-
transition to v5.0.0 straightforward.
|
|
420
|
-
>
|
|
421
|
-
> The breaking changes will primarily affect users who have been relying on the
|
|
422
|
-
internal g.lib accessor, which will be removed as part of this cleanup. For more
|
|
423
|
-
details, please see the "Impact on Users" section in [the redesign
|
|
424
|
-
document](redesign/2_architecture_redesign.md).
|
|
484
|
+
The three documents written to plan it are kept as a historical record in
|
|
485
|
+
[`archive/v5-redesign/`](archive/v5-redesign/). They describe the state of the code
|
|
486
|
+
before and during the migration and are not current policy. The standards that apply
|
|
487
|
+
to new code live in [`.github/skills/`](.github/skills/).
|
|
425
488
|
|
|
426
|
-
|
|
489
|
+
1. [Analysis of the Current Architecture](archive/v5-redesign/1_architecture_existing.md):
|
|
490
|
+
a breakdown of the v4.x design and its challenges.
|
|
491
|
+
2. [The Proposed Redesign](archive/v5-redesign/2_architecture_redesign.md): an overview
|
|
492
|
+
of the three-layer architecture.
|
|
493
|
+
3. [Implementation Plan](archive/v5-redesign/3_architecture_implementation.md): the
|
|
494
|
+
step-by-step plan that was followed.
|
|
427
495
|
|
|
428
|
-
|
|
429
|
-
adopted [RuboCop](https://rubocop.org/) as our static code analyzer and formatter.
|
|
496
|
+
### 2025-07-07: We now use RuboCop
|
|
430
497
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
498
|
+
To improve code consistency and maintainability, the `ruby-git` project has adopted
|
|
499
|
+
[RuboCop](https://rubocop.org/) as our static code analyzer and formatter. All new
|
|
500
|
+
contributions must follow the style guidelines enforced by our RuboCop
|
|
501
|
+
configuration.
|
|
434
502
|
|
|
435
|
-
RuboCop
|
|
503
|
+
Run RuboCop from the project's Rakefile:
|
|
436
504
|
|
|
437
505
|
```shell
|
|
438
506
|
rake rubocop
|
|
439
507
|
```
|
|
440
508
|
|
|
441
|
-
RuboCop
|
|
442
|
-
|
|
509
|
+
RuboCop also runs as part of the default rake task, which our continuous integration
|
|
510
|
+
workflow runs.
|
|
443
511
|
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
scope possible.
|
|
512
|
+
PRs with RuboCop offenses will not be merged. In rare cases, it might be acceptable
|
|
513
|
+
to disable a RuboCop check for the most limited scope possible.
|
|
447
514
|
|
|
448
|
-
If you have a problem fixing a
|
|
515
|
+
If you have a problem fixing a RuboCop offense, don't be afraid to ask a
|
|
449
516
|
contributor.
|
|
450
517
|
|
|
451
|
-
### 2025-06-06: Default
|
|
518
|
+
### 2025-06-06: Default branch rename
|
|
452
519
|
|
|
453
|
-
On June
|
|
520
|
+
On June 6, 2025, we renamed the default branch from `master` to `main`.
|
|
454
521
|
|
|
455
|
-
Instructions for renaming your local or forked branch to match
|
|
456
|
-
|
|
522
|
+
Instructions for renaming your local or forked branch to match are in the gist
|
|
523
|
+
[Default Branch Name
|
|
457
524
|
Change](https://gist.github.com/jcouball/580a10e395f7fdfaaa4297bbe816cc7d).
|
|
458
525
|
|
|
459
|
-
### 2025-05-15: We've
|
|
526
|
+
### 2025-05-15: We've switched to Conventional Commits
|
|
460
527
|
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
528
|
+
The `ruby-git` project has adopted the [Conventional Commits
|
|
529
|
+
standard](https://www.conventionalcommits.org/en/v1.0.0/) for all commit messages.
|
|
530
|
+
This enables automated changelog generation and is a step toward continuous
|
|
531
|
+
delivery.
|
|
465
532
|
|
|
466
|
-
|
|
467
|
-
Commits
|
|
468
|
-
|
|
533
|
+
All commits to this repository must follow the Conventional Commits standard.
|
|
534
|
+
Commits that do not follow it will fail the CI build, and PRs that include them will
|
|
535
|
+
not be merged.
|
|
469
536
|
|
|
470
|
-
|
|
471
|
-
|
|
537
|
+
To validate your commit messages locally before pushing them to GitHub, install the
|
|
538
|
+
git `commit-msg` hook by running `bin/setup` in the project root.
|
|
472
539
|
|
|
473
540
|
Read more about this change in the [Commit Message Guidelines section of
|
|
474
|
-
CONTRIBUTING.md](CONTRIBUTING.md#commit-message-guidelines)
|
|
541
|
+
CONTRIBUTING.md](CONTRIBUTING.md#commit-message-guidelines).
|