git 5.0.0.beta.5 → 5.0.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/.gitignore +2 -0
- data/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +520 -0
- data/README.md +53 -475
- data/UPGRADING.md +26 -0
- data/lib/git/branch.rb +5 -1
- data/lib/git/branch_info.rb +135 -76
- data/lib/git/branches.rb +1 -1
- data/lib/git/log.rb +12 -6
- data/lib/git/object.rb +5 -2
- data/lib/git/parsers/branch.rb +62 -64
- data/lib/git/parsers/remote.rb +162 -0
- data/lib/git/remote.rb +1 -22
- data/lib/git/remote_info.rb +146 -0
- data/lib/git/repository/branching.rb +57 -22
- data/lib/git/repository/committing.rb +25 -6
- data/lib/git/repository/context_helpers.rb +1 -1
- data/lib/git/repository/diffing.rb +2 -1
- data/lib/git/repository/factories.rb +10 -3
- data/lib/git/repository/merging.rb +5 -5
- data/lib/git/repository/remote_operations.rb +64 -8
- data/lib/git/repository/staging.rb +13 -4
- data/lib/git/repository/stashing.rb +1 -1
- data/lib/git/repository/status_operations.rb +1 -1
- data/lib/git/version.rb +1 -1
- data/lib/git.rb +8 -5
- data/redesign/branch_parse_refactor_plan.md +163 -0
- data/redesign/info_object_migration_plan.md +126 -0
- data/redesign/integration_test_analysis.md +521 -0
- data/redesign/remote_refactor_plan.md +164 -0
- metadata +10 -4
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# Plan: RemoteInfo + RemoteOperations API Modernization
|
|
2
|
+
|
|
3
|
+
> **Note:** Issue #919 fix (`BranchInfo#remote_name` for slash-containing remotes) is
|
|
4
|
+
> deferred to a separate effort and is not part of this plan.
|
|
5
|
+
|
|
6
|
+
## TL;DR
|
|
7
|
+
|
|
8
|
+
Three PRs in order:
|
|
9
|
+
|
|
10
|
+
- **PR 1** (smallest, independent): `remote_add` / `remote_set_url` return `nil`
|
|
11
|
+
- **PR 2** (data layer foundation): `Git::RemoteInfo` value object + `Parsers::Remote`
|
|
12
|
+
- **PR 3** (depends on PR 2): `remote_list` facade method + deprecate `remotes`
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## PR 1 — `remote_add` / `remote_set_url` return `nil` *(independent, smallest)*
|
|
17
|
+
|
|
18
|
+
**Step A.** `remote_add` — remove `Git::Remote.new(self, name)`, return `nil` explicitly
|
|
19
|
+
- File: `lib/git/repository/remote_operations.rb`
|
|
20
|
+
|
|
21
|
+
**Step B.** `remote_set_url` — same change
|
|
22
|
+
|
|
23
|
+
**Step C.** Fix deprecated wrappers (can no longer just forward the return value):
|
|
24
|
+
- `add_remote` → call `remote_add(...)` then `Git::Remote.new(self, name)`
|
|
25
|
+
- `set_remote_url` → call `remote_set_url(...)` then `Git::Remote.new(self, name)`
|
|
26
|
+
|
|
27
|
+
**Step D.** Update YARD `@return` on `remote_add` and `remote_set_url` to `@return [void]`
|
|
28
|
+
(per project convention: methods with no meaningful return value use `@return [void]`,
|
|
29
|
+
matching `remote_set_branches` and other mutation-only methods)
|
|
30
|
+
|
|
31
|
+
**Step E.** Update specs that assert `remote_add` / `remote_set_url` return a `Git::Remote`
|
|
32
|
+
|
|
33
|
+
### Files changed in PR 1
|
|
34
|
+
|
|
35
|
+
- `lib/git/repository/remote_operations.rb`
|
|
36
|
+
- `spec/unit/git/repository/remote_operations_spec.rb`
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## PR 2 — `Git::RemoteInfo` data class + `Parsers::Remote` *(data layer foundation)*
|
|
41
|
+
|
|
42
|
+
**Step 1.** Create `lib/git/remote_info.rb`:
|
|
43
|
+
|
|
44
|
+
```ruby
|
|
45
|
+
module Git
|
|
46
|
+
RemoteInfo = Data.define(
|
|
47
|
+
:name, # String — required
|
|
48
|
+
:url, # Array<String>
|
|
49
|
+
:push_url, # Array<String>
|
|
50
|
+
:fetch, # Array<String>
|
|
51
|
+
:push, # Array<String>
|
|
52
|
+
:mirror, # Boolean | nil
|
|
53
|
+
:skip_default_update, # Boolean | nil
|
|
54
|
+
:tag_opt, # String | nil
|
|
55
|
+
:prune, # Boolean | nil (nil = inherit global fetch.prune)
|
|
56
|
+
:prune_tags, # Boolean | nil (nil = inherit global fetch.pruneTags)
|
|
57
|
+
:receivepack, # String | nil
|
|
58
|
+
:uploadpack, # String | nil
|
|
59
|
+
:promisor, # Boolean | nil
|
|
60
|
+
:partial_clone_filter, # String | nil
|
|
61
|
+
:vcs # String | nil
|
|
62
|
+
)
|
|
63
|
+
end
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
- Multi-value fields (`:url`, `:push_url`, `:fetch`, `:push`) are always `Array<String>` (never
|
|
67
|
+
`nil`; may be empty). All other fields are nilable except `:name`.
|
|
68
|
+
- Use **snake_case** field names throughout
|
|
69
|
+
|
|
70
|
+
**Step 2.** Create `lib/git/parsers/remote.rb`:
|
|
71
|
+
|
|
72
|
+
- `Git::Parsers::Remote.parse_list(config_entries)` — accepts an
|
|
73
|
+
`Array<Git::ConfigEntryInfo>` (as returned by `Git::Configuring#config_list`),
|
|
74
|
+
groups entries by remote name, and builds `RemoteInfo` objects
|
|
75
|
+
- Using `Array<Git::ConfigEntryInfo>` as input naturally preserves duplicate keys
|
|
76
|
+
(e.g., multiple `remote.<name>.fetch` refspecs or multiple `url` values),
|
|
77
|
+
which a flat `Hash{String=>String}` cannot represent
|
|
78
|
+
- Multi-value fields (`:url`, `:push_url`, `:fetch`, `:push`) are collected into arrays
|
|
79
|
+
- Boolean fields are coerced matching git's own boolean rules:
|
|
80
|
+
- **True values**: `"true"`, `"yes"`, `"on"`, `"1"`, `""` (key present without a value) → `true`
|
|
81
|
+
- **False values**: `"false"`, `"no"`, `"off"`, `"0"` → `false`
|
|
82
|
+
- **Absent** (key not present in config at all) → `nil`
|
|
83
|
+
- **Unrecognized value**: raise `ArgumentError` (mirrors git's fatal error behavior)
|
|
84
|
+
- Config key → Ruby field mapping (for keys that differ from the field name):
|
|
85
|
+
|
|
86
|
+
| git config key | `RemoteInfo` field |
|
|
87
|
+
|---|---|
|
|
88
|
+
| `url` | `:url` (Array) |
|
|
89
|
+
| `pushurl` | `:push_url` (Array) |
|
|
90
|
+
| `fetch` | `:fetch` (Array) |
|
|
91
|
+
| `push` | `:push` (Array) |
|
|
92
|
+
| `tagOpt` | `:tag_opt` |
|
|
93
|
+
| `partialclonefilter` | `:partial_clone_filter` |
|
|
94
|
+
| `skipDefaultUpdate` | `:skip_default_update` |
|
|
95
|
+
| `pruneTags` | `:prune_tags` |
|
|
96
|
+
| `promisor` | `:promisor` (no case change, but in the mapping table) |
|
|
97
|
+
| `mirror`, `prune`, `receivepack`, `uploadpack`, `vcs` | direct lowercase match |
|
|
98
|
+
|
|
99
|
+
**Step 3.** Unit tests for `Parsers::Remote`:
|
|
100
|
+
- Single remote with only required fields
|
|
101
|
+
- Remote with multiple URLs and fetch specs
|
|
102
|
+
- Multiple remotes in one config entry array
|
|
103
|
+
- Empty input → empty array
|
|
104
|
+
- Boolean field coercion (true/false/nil/raise on unrecognized value)
|
|
105
|
+
|
|
106
|
+
### Files changed in PR 2
|
|
107
|
+
|
|
108
|
+
- `lib/git/remote_info.rb` — new file
|
|
109
|
+
- `lib/git/parsers/remote.rb` — new file
|
|
110
|
+
- `spec/unit/git/remote_info_spec.rb` — new
|
|
111
|
+
- `spec/unit/git/parsers/remote_spec.rb` — new
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## PR 3 — `remote_list` facade method + `remotes` deprecation *(depends on PR 2)*
|
|
116
|
+
|
|
117
|
+
**Step 4.** Add `remote_list` to `Git::Repository::RemoteOperations`:
|
|
118
|
+
- Calls `config_list` (the `Git::Configuring` instance method, already mixed into
|
|
119
|
+
`Git::Repository`) to get all config entries as `Array<Git::ConfigEntryInfo>`
|
|
120
|
+
- Filters for entries whose key starts with `remote.`, passes to
|
|
121
|
+
`Git::Parsers::Remote.parse_list`
|
|
122
|
+
- Returns `Array<Git::RemoteInfo>`
|
|
123
|
+
- File: `lib/git/repository/remote_operations.rb`
|
|
124
|
+
- Note: this replaces the use of `Private.config_list` (which returns a flat hash
|
|
125
|
+
that loses duplicate keys and cannot represent multi-value config fields)
|
|
126
|
+
|
|
127
|
+
**Step 5.** Deprecate `remotes`:
|
|
128
|
+
- Add `Git::Deprecation.warn(...)` pointing to `remote_list`
|
|
129
|
+
- Keep returning `Array<Git::Remote>` for backward compat
|
|
130
|
+
|
|
131
|
+
**Step 6.** Unit + integration tests for `remote_list`
|
|
132
|
+
|
|
133
|
+
### Files changed in PR 3
|
|
134
|
+
|
|
135
|
+
- `lib/git/repository/remote_operations.rb`
|
|
136
|
+
- `spec/unit/git/repository/remote_operations_spec.rb`
|
|
137
|
+
- `spec/integration/git/repository/remote_operations_spec.rb`
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Decisions
|
|
142
|
+
|
|
143
|
+
- `remote_show(name)` deferred — add after `remote_list` lands
|
|
144
|
+
- `remotes` deprecated (not removed) — still returns `Array<Git::Remote>` for compat
|
|
145
|
+
- `remote_add` / `remote_set_url` return `nil` — breaking change acceptable in beta
|
|
146
|
+
- Deprecated wrappers (`add_remote`, `set_remote_url`) still return `Git::Remote`
|
|
147
|
+
- `RemoteInfo` fields are **snake_case** (not camelCase)
|
|
148
|
+
- Data source for `remote_list`: `Git::Configuring#config_list` (the instance method
|
|
149
|
+
mixed into `Git::Repository`), which returns `Array<Git::ConfigEntryInfo>` and
|
|
150
|
+
preserves duplicate keys — **not** `Private.config_list` (which returns a flat
|
|
151
|
+
`Hash{String=>String}` and cannot represent multi-value fields)
|
|
152
|
+
- **Boolean fields** are three-state `true`/`false`/`nil`; `nil` means "not configured"
|
|
153
|
+
and is semantically distinct from `false` for `:prune` and `:prune_tags`
|
|
154
|
+
(those inherit from global `fetch.prune` / `fetch.pruneTags` when `nil`)
|
|
155
|
+
- **Multi-value fields**: `:url`, `:push_url`, `:fetch`, `:push` are all `Array<String>`
|
|
156
|
+
- **`require` statements** are an implementation detail; add as needed
|
|
157
|
+
- **`config_remote`** — its relationship to `remote_list` is not addressed in this plan
|
|
158
|
+
|
|
159
|
+
## Out of scope
|
|
160
|
+
|
|
161
|
+
- Issue #919 fix (`BranchInfo#remote_name` for slash remotes) — separate effort
|
|
162
|
+
- `Git::Remote#branch` deprecation — not part of this plan
|
|
163
|
+
- `Git::Remote` and `Git::Branch` deprecation — separate future effort
|
|
164
|
+
- `remote_show(name)` single-remote lookup — deferred until after `remote_list` lands
|
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.0.0
|
|
4
|
+
version: 5.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Scott Chacon and others
|
|
@@ -560,9 +560,11 @@ files:
|
|
|
560
560
|
- lib/git/parsers/grep.rb
|
|
561
561
|
- lib/git/parsers/ls_remote.rb
|
|
562
562
|
- lib/git/parsers/ls_tree.rb
|
|
563
|
+
- lib/git/parsers/remote.rb
|
|
563
564
|
- lib/git/parsers/stash.rb
|
|
564
565
|
- lib/git/parsers/tag.rb
|
|
565
566
|
- lib/git/remote.rb
|
|
567
|
+
- lib/git/remote_info.rb
|
|
566
568
|
- lib/git/repository.rb
|
|
567
569
|
- lib/git/repository/branching.rb
|
|
568
570
|
- lib/git/repository/committing.rb
|
|
@@ -601,12 +603,16 @@ files:
|
|
|
601
603
|
- redesign/Phase 4 - Step B.md
|
|
602
604
|
- redesign/Phase 4 - Step C.md
|
|
603
605
|
- redesign/beta_release.md
|
|
606
|
+
- redesign/branch_parse_refactor_plan.md
|
|
604
607
|
- redesign/c1a-public-api-scope.tsv
|
|
605
608
|
- redesign/c1c2_audit.md
|
|
606
609
|
- redesign/c1c2_bucket6_lib_orphans.md
|
|
607
610
|
- redesign/config_design.rb
|
|
608
611
|
- redesign/index.md
|
|
612
|
+
- redesign/info_object_migration_plan.md
|
|
613
|
+
- redesign/integration_test_analysis.md
|
|
609
614
|
- redesign/phase-4-step-b-test-audit.tsv
|
|
615
|
+
- redesign/remote_refactor_plan.md
|
|
610
616
|
- redesign/reverse_dependencies.sql
|
|
611
617
|
- tasks/gem_tasks.rake
|
|
612
618
|
- tasks/npm_tasks.rake
|
|
@@ -620,8 +626,8 @@ licenses:
|
|
|
620
626
|
metadata:
|
|
621
627
|
homepage_uri: http://github.com/ruby-git/ruby-git
|
|
622
628
|
source_code_uri: http://github.com/ruby-git/ruby-git
|
|
623
|
-
changelog_uri: https://rubydoc.info/gems/git/5.0.0
|
|
624
|
-
documentation_uri: https://rubydoc.info/gems/git/5.0.0
|
|
629
|
+
changelog_uri: https://rubydoc.info/gems/git/5.0.0/file/CHANGELOG.md
|
|
630
|
+
documentation_uri: https://rubydoc.info/gems/git/5.0.0
|
|
625
631
|
rubygems_mfa_required: 'true'
|
|
626
632
|
rdoc_options: []
|
|
627
633
|
require_paths:
|
|
@@ -638,7 +644,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
638
644
|
version: '0'
|
|
639
645
|
requirements:
|
|
640
646
|
- git 2.28.0 or greater
|
|
641
|
-
rubygems_version: 4.0.
|
|
647
|
+
rubygems_version: 4.0.16
|
|
642
648
|
specification_version: 4
|
|
643
649
|
summary: An API to create, read, and manipulate Git repositories
|
|
644
650
|
test_files: []
|