git 5.1.0 → 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.
Files changed (101) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +45 -0
  3. data/CONTRIBUTING.md +185 -165
  4. data/LICENSE +1 -1
  5. data/README.md +151 -151
  6. data/git.gemspec +35 -3
  7. data/lib/git/command_line/base.rb +1 -2
  8. data/lib/git/commands/base.rb +1 -1
  9. data/lib/git/commands/cat_file/raw.rb +8 -7
  10. data/lib/git/repository/branching.rb +79 -5
  11. data/lib/git/version.rb +1 -1
  12. metadata +5 -94
  13. data/.claude/commands/address-copilot-reviews.md +0 -14
  14. data/.claude/settings.json +0 -16
  15. data/.claude/skills +0 -1
  16. data/.commitlintrc.yml +0 -38
  17. data/.dockerignore +0 -27
  18. data/.github/copilot-instructions.md +0 -30
  19. data/.github/hooks/bin-setup-on-worktree.json +0 -11
  20. data/.github/hooks/run-bin-setup-once.sh +0 -20
  21. data/.github/issue_template.md +0 -15
  22. data/.github/prompts/iteratively-address-copilot-reviews.prompt.md +0 -188
  23. data/.github/pull_request_template.md +0 -21
  24. data/.github/skills/breaking-change-analysis/SKILL.md +0 -99
  25. data/.github/skills/ci-cd-troubleshooting/SKILL.md +0 -264
  26. data/.github/skills/command-implementation/REFERENCE.md +0 -994
  27. data/.github/skills/command-implementation/SKILL.md +0 -230
  28. data/.github/skills/command-test-conventions/SKILL.md +0 -664
  29. data/.github/skills/command-yard-documentation/SKILL.md +0 -434
  30. data/.github/skills/dependency-management/SKILL.md +0 -72
  31. data/.github/skills/development-workflow/SKILL.md +0 -512
  32. data/.github/skills/facade-implementation/REFERENCE.md +0 -837
  33. data/.github/skills/facade-implementation/SKILL.md +0 -269
  34. data/.github/skills/facade-test-conventions/SKILL.md +0 -391
  35. data/.github/skills/facade-yard-documentation/SKILL.md +0 -435
  36. data/.github/skills/make-skill-template/SKILL.md +0 -226
  37. data/.github/skills/pr-readiness-review/SKILL.md +0 -205
  38. data/.github/skills/project-context/SKILL.md +0 -306
  39. data/.github/skills/pull-request-review/SKILL.md +0 -168
  40. data/.github/skills/rebase/SKILL.md +0 -148
  41. data/.github/skills/refactor-command-to-commandlineresult/SKILL.md +0 -131
  42. data/.github/skills/release-management/SKILL.md +0 -125
  43. data/.github/skills/resolve-feedback/SKILL.md +0 -288
  44. data/.github/skills/review-arguments-dsl/CHECKLIST.md +0 -788
  45. data/.github/skills/review-arguments-dsl/SKILL.md +0 -214
  46. data/.github/skills/review-cross-command-consistency/SKILL.md +0 -139
  47. data/.github/skills/reviewing-skills/SKILL.md +0 -214
  48. data/.github/skills/rspec-unit-testing-standards/SKILL.md +0 -685
  49. data/.github/skills/tdd-refactor-step/SKILL.md +0 -236
  50. data/.github/skills/test-debugging/SKILL.md +0 -161
  51. data/.github/skills/yard-documentation/SKILL.md +0 -981
  52. data/.github/skills/yard-documentation/element-rules.md +0 -162
  53. data/.github/skills-deprecated/README.md +0 -21
  54. data/.github/skills-deprecated/extract-command-from-lib/SKILL.md +0 -487
  55. data/.github/skills-deprecated/extract-facade-from-base-lib/KEYWORD_ARG_REMEDIATION.md +0 -22
  56. data/.github/skills-deprecated/extract-facade-from-base-lib/SKILL.md +0 -600
  57. data/.github/skills-deprecated/review-backward-compatibility/SKILL.md +0 -275
  58. data/.github/workflows/continuous_integration.yml +0 -358
  59. data/.github/workflows/enforce_conventional_commits.yml +0 -35
  60. data/.github/workflows/experimental_continuous_integration.yml +0 -59
  61. data/.github/workflows/release.yml +0 -52
  62. data/.github/workflows/warm_bundler_caches.yml +0 -82
  63. data/.gitignore +0 -30
  64. data/.husky/commit-msg +0 -1
  65. data/.husky/pre-commit +0 -13
  66. data/.release-please-config.json +0 -36
  67. data/.release-please-manifest.json +0 -3
  68. data/.rspec +0 -2
  69. data/.rubocop.yml +0 -44
  70. data/.rubocop_todo.yml +0 -30
  71. data/.yard-lint.yml +0 -75
  72. data/CLAUDE.md +0 -11
  73. data/Gemfile +0 -22
  74. data/Rakefile +0 -41
  75. data/docker/test/Dockerfile +0 -32
  76. data/docker/test/docker-compose.yml +0 -0
  77. data/package.json +0 -10
  78. data/redesign/1_architecture_existing.md +0 -102
  79. data/redesign/2_architecture_redesign.md +0 -449
  80. data/redesign/3_architecture_implementation.md +0 -1623
  81. data/redesign/Phase 4 - Step A.md +0 -366
  82. data/redesign/Phase 4 - Step B.md +0 -921
  83. data/redesign/Phase 4 - Step C.md +0 -833
  84. data/redesign/beta_release.md +0 -107
  85. data/redesign/branch_parse_refactor_plan.md +0 -163
  86. data/redesign/c1a-public-api-scope.tsv +0 -256
  87. data/redesign/c1c2_audit.md +0 -566
  88. data/redesign/c1c2_bucket6_lib_orphans.md +0 -626
  89. data/redesign/config_design.rb +0 -501
  90. data/redesign/index.md +0 -34
  91. data/redesign/info_object_migration_plan.md +0 -126
  92. data/redesign/integration_test_analysis.md +0 -521
  93. data/redesign/phase-4-step-b-test-audit.tsv +0 -485
  94. data/redesign/remote_refactor_plan.md +0 -164
  95. data/redesign/reverse_dependencies.sql +0 -44
  96. data/tasks/gem_tasks.rake +0 -14
  97. data/tasks/npm_tasks.rake +0 -7
  98. data/tasks/rspec.rake +0 -111
  99. data/tasks/rubocop.rake +0 -5
  100. data/tasks/test_gem.rake +0 -12
  101. data/tasks/yard.rake +0 -57
@@ -1,236 +0,0 @@
1
- ---
2
- name: tdd-refactor-step
3
- description: 'Guides the REFACTOR step of the TDD cycle — identifying code smells, applying safe refactoring techniques, cleaning test code, and verifying with rubocop. Use during RED-GREEN-REFACTOR when deciding what and how to refactor after making a test pass.'
4
- ---
5
-
6
- # TDD Refactor Step
7
-
8
- Concrete guidance for the REFACTOR step of the RED-GREEN-REFACTOR cycle. Covers
9
- code smells to look for, safe refactoring techniques, test code cleanup,
10
- rubocop integration, and verification.
11
-
12
- ## Contents
13
-
14
- - [How to use this skill](#how-to-use-this-skill)
15
- - [Related skills](#related-skills)
16
- - [Decision: refactor or skip](#decision-refactor-or-skip)
17
- - [Code smells checklist](#code-smells-checklist)
18
- - [Refactoring techniques](#refactoring-techniques)
19
- - [Test code refactoring](#test-code-refactoring)
20
- - [Rubocop integration](#rubocop-integration)
21
- - [Verification](#verification)
22
- - [Project-specific patterns](#project-specific-patterns)
23
- - [Boundaries](#boundaries)
24
-
25
- ## How to use this skill
26
-
27
- Invoke this skill during the REFACTOR step of the TDD cycle, after GREEN
28
- (all tests pass). This skill expands the guidance in the
29
- [Development Workflow](../development-workflow/SKILL.md) REFACTOR step.
30
-
31
- Typical invocation:
32
-
33
- ```text
34
- I just got to green. Walk me through the REFACTOR step using
35
- the TDD Refactor Step skill.
36
- ```
37
-
38
- ## Related skills
39
-
40
- - [Development Workflow](../development-workflow/SKILL.md) — parent TDD workflow;
41
- this skill supplements its REFACTOR step
42
- - [RSpec Unit Testing Standards](../rspec-unit-testing-standards/SKILL.md) — test
43
- conventions that refactored tests must follow
44
- - [PR Readiness Review](../pr-readiness-review/SKILL.md) — final quality gate
45
- that catches remaining quality issues
46
-
47
- ## Decision: refactor or skip
48
-
49
- Not every GREEN step needs refactoring. Skip when **all** of the following are true:
50
-
51
- - No hardcoded values from the GREEN step remain
52
- - No duplication was introduced between new and existing code
53
- - No method exceeds ~10 lines
54
- - No parameter list exceeds 3 positional parameters
55
- - Rubocop reports no new offenses on changed files
56
- - Test setup is not duplicated across examples
57
-
58
- If any condition is false, proceed with the relevant technique below.
59
-
60
- ## Code smells checklist
61
-
62
- Check the code written or modified in this task for these smells, in priority order:
63
-
64
- | # | Smell | Threshold | Action |
65
- | --- | ----- | --------- | ------ |
66
- | 1 | **Hardcoded values** from GREEN step | Any | Generalize to actual logic |
67
- | 2 | **Duplication** between new code and existing code | ≥ 3 similar lines | Extract shared method or constant |
68
- | 3 | **Long method** | > 10 lines (body) | Extract private helper |
69
- | 4 | **Long parameter list** | > 3 positional params | Convert trailing params to keyword arguments |
70
- | 5 | **Inconsistent naming** | Deviates from file/module conventions | Rename to match existing patterns |
71
- | 6 | **Deeply nested conditionals** | > 2 levels | Extract guard clause or helper |
72
- | 7 | **Feature envy** | Method uses another object's data more than its own | Move method or extract delegator |
73
- | 8 | **Dead code** | Unreachable branches, unused variables | Remove |
74
-
75
- Limit yourself to smells **in files you touched this task**. Broader cleanup belongs
76
- in a separate task (add it during REPLAN).
77
-
78
- ## Refactoring techniques
79
-
80
- Apply the simplest technique that resolves the smell:
81
-
82
- ### Extract method
83
-
84
- Split a long method into a public method and one or more private helpers. Name
85
- the helper after **what** it does, not **how**:
86
-
87
- ```ruby
88
- # Before
89
- def call(*, **)
90
- bound = args_definition.bind(*, **)
91
- objects = Array(bound.objects).map { |o| "#{o}\n" }.join
92
- with_stdin(objects) { |r| run_batch(bound, r) }
93
- end
94
-
95
- # After
96
- def call(*, **)
97
- bound = args_definition.bind(*, **)
98
- with_stdin(stdin_content(bound)) { |r| run_batch(bound, r) }
99
- end
100
-
101
- private
102
-
103
- def stdin_content(bound)
104
- Array(bound.objects).map { |o| "#{o}\n" }.join
105
- end
106
- ```
107
-
108
- ### Convert positional to keyword arguments
109
-
110
- When a method accumulates optional trailing positional parameters:
111
-
112
- ```ruby
113
- # Before
114
- def initialize(args, options, positionals, exec_names = [], flags = [])
115
-
116
- # After
117
- def initialize(args, options, positionals, exec_names: [], flags: [])
118
- ```
119
-
120
- Update the single call site at the same time.
121
-
122
- ### Replace conditional with guard clause
123
-
124
- ```ruby
125
- # Before
126
- def validate(value)
127
- if value
128
- if value.is_a?(String)
129
- process(value)
130
- end
131
- end
132
- end
133
-
134
- # After
135
- def validate(value)
136
- return unless value
137
- return unless value.is_a?(String)
138
-
139
- process(value)
140
- end
141
- ```
142
-
143
- ### Introduce constant
144
-
145
- When a magic value appears in logic:
146
-
147
- ```ruby
148
- # Before
149
- raise error if version < Git::Version.parse('2.28.0')
150
-
151
- # After
152
- MINIMUM_GIT_VERSION = Git::Version.parse('2.28.0')
153
- raise error if version < MINIMUM_GIT_VERSION
154
- ```
155
-
156
- ### Eliminate duplication with shared setup
157
-
158
- When two methods share identical preamble or teardown, extract the shared part.
159
- If the duplication is in tests, see Test Code Refactoring below.
160
-
161
- ## Test code refactoring
162
-
163
- Test code deserves the same refactoring attention as production code:
164
-
165
- | Smell | Technique |
166
- | ----- | --------- |
167
- | Duplicated `let`/`before` across contexts | Move to nearest shared `describe` or `context` |
168
- | Long example bodies (> 5 lines of setup) | Extract to `let` declarations or `before` block |
169
- | Repeated literal values | Extract to `let` or constant at top of file |
170
- | Identical examples across files | Extract to shared example group (`shared_examples`) |
171
- | Unclear example descriptions | Rewrite to state expected behavior, not implementation |
172
-
173
- Follow the [RSpec Unit Testing Standards](../rspec-unit-testing-standards/SKILL.md)
174
- for the resulting test structure.
175
-
176
- ## Rubocop integration
177
-
178
- Run rubocop on changed files after refactoring:
179
-
180
- ```bash
181
- bundle exec rubocop $(git diff --name-only HEAD)
182
- ```
183
-
184
- Focus on:
185
- - `Metrics/MethodLength` — methods over the configured limit
186
- - `Metrics/ParameterLists` — too many parameters
187
- - `Metrics/AbcSize` — complexity threshold
188
- - `Style` cops — naming, formatting consistency
189
-
190
- Auto-correct safe offenses when appropriate:
191
-
192
- ```bash
193
- bundle exec rubocop -a $(git diff --name-only HEAD)
194
- ```
195
-
196
- Do not auto-correct `Metrics` cops — those require structural changes (extract
197
- method, split class), not formatting fixes.
198
-
199
- ## Verification
200
-
201
- After refactoring, confirm:
202
-
203
- 1. **Tests still pass:** `bundle exec rspec <spec_file>` for the current task's
204
- test file(s)
205
- 2. **No new rubocop offenses:** `bundle exec rubocop $(git diff --name-only HEAD)`
206
- 3. **Behavior unchanged:** No new test was added during REFACTOR — if you need
207
- a new test, you skipped a RED step
208
-
209
- If any test fails after refactoring, the refactoring changed behavior. Revert
210
- and try a smaller change.
211
-
212
- ## Project-specific patterns
213
-
214
- Patterns specific to this codebase that the REFACTOR step should enforce:
215
-
216
- - **Command classes** should not contain parsing logic — if refactoring reveals
217
- parsing in a command class, flag it for extraction (separate task)
218
- - **Arguments DSL** `Bound` metadata uses keyword arguments — if adding new
219
- metadata fields, follow the keyword argument pattern
220
- - **Error classes** inherit from `Git::Error` — ensure new errors follow the
221
- hierarchy in `lib/git/errors.rb`
222
- - **`freeze` constants** — all new constants should be frozen
223
- (`CONSTANT = value.freeze`)
224
- - **Private methods** go below a single `private` keyword, not inline
225
- `private def`
226
-
227
- ## Boundaries
228
-
229
- Things the REFACTOR step must **not** do:
230
-
231
- - **Add new behavior** — no new features, no new test cases
232
- - **Change public API** — method signatures visible to users stay the same
233
- - **Touch unrelated files** — scope to files modified in this task; add broader
234
- refactoring to the task list during REPLAN
235
- - **Optimize prematurely** — clarity over performance unless profiling data exists
236
- - **Over-abstract** — do not create a helper for something used exactly once
@@ -1,161 +0,0 @@
1
- ---
2
- name: test-debugging
3
- description: "Debugs failing or flaky tests and improves test coverage. Use when tests fail consistently, exhibit intermittent behavior, or when adding missing test coverage."
4
- ---
5
-
6
- # Test Debugging & Maintenance Workflow
7
-
8
- When asked to debug tests or improve test coverage, follow this workflow to identify
9
- problems, determine root causes, and apply appropriate fixes.
10
-
11
- ## Contents
12
-
13
- - [How to use this skill](#how-to-use-this-skill)
14
- - [Related skills](#related-skills)
15
- - [Step 1: Run and Observe the Test](#step-1-run-and-observe-the-test)
16
- - [Step 2: Investigate Root Cause](#step-2-investigate-root-cause)
17
- - [Step 3: Report Findings](#step-3-report-findings)
18
- - [Step 4: Determine Fix Strategy](#step-4-determine-fix-strategy)
19
- - [Step 5: Verify Test Fix](#step-5-verify-test-fix)
20
- - [Project-Specific Considerations](#project-specific-considerations)
21
-
22
- ## How to use this skill
23
-
24
- Attach this file to your Copilot Chat context, then invoke it with the failing
25
- test file, test name, or flakiness symptom. Stop at Step 3 for diagnosis-only
26
- requests unless the user asks for implementation.
27
-
28
- ## Related skills
29
-
30
- - [RSpec Unit Testing Standards](../rspec-unit-testing-standards/SKILL.md) — rules
31
- governing test isolation, determinism, and order independence (Rules 25–28); consult
32
- when flakiness is caused by a test design violation rather than a production bug
33
- - [Development Workflow](../development-workflow/SKILL.md) — required TDD process
34
- when fixes involve production code
35
- - [CI/CD Troubleshooting](../ci-cd-troubleshooting/SKILL.md) — investigate
36
- failures that appear only in CI
37
-
38
- ## Step 1: Run and Observe the Test
39
-
40
- 1. **Run the failing test:**
41
-
42
- ```bash
43
- # RSpec unit test
44
- bundle exec rspec spec/unit/git/commands/<command>_spec.rb
45
-
46
- # RSpec integration test
47
- bundle exec rspec spec/integration/git/commands/<command>_spec.rb
48
-
49
- # Specific example, by line number
50
- bundle exec rspec spec/unit/git/commands/<command>_spec.rb:42
51
- ```
52
-
53
- 2. **For suspected flaky tests, run multiple times:**
54
-
55
- ```bash
56
- for i in {1..20}; do
57
- echo "Run $i"
58
- bundle exec rspec <spec_file> || break
59
- done
60
- ```
61
-
62
- 3. **Check test isolation** — run the test alone vs. within the full suite:
63
-
64
- ```bash
65
- bundle exec rspec <spec_file> # alone
66
- bundle exec rake default # full suite
67
- ```
68
-
69
- ## Step 2: Investigate Root Cause
70
-
71
- 1. **Read the full error** including stack trace. Identify exact failing line and
72
- expected vs. actual values.
73
-
74
- 2. **Check recent changes** with `git log` and `git blame` on the test file and
75
- related production code.
76
-
77
- 3. **For flaky tests**, look for:
78
- - Shared state between tests (global/class variables, shared filesystem resources)
79
- - Timing dependencies or race conditions
80
- - Non-deterministic behavior (time-dependent logic, unordered iteration)
81
- - Test execution order dependencies
82
-
83
- 4. **For environment issues**, check:
84
- - Platform differences (paths, line endings, permissions)
85
- - Git version differences (use `git --version`)
86
- - Ruby version differences
87
-
88
- ## Step 3: Report Findings
89
-
90
- Present diagnostic findings to the user:
91
-
92
- ```markdown
93
- # Test Failure Diagnosis: <test_name>
94
-
95
- **Failure Type:** [Consistent / Flaky / Coverage Gap]
96
- **Test File:** <path/to/test_file.rb>
97
-
98
- ## Error
99
- <error message and relevant stack trace>
100
-
101
- ## Root Cause
102
- <Explanation of why the test is failing>
103
-
104
- ## Recommended Fix
105
- <Specific recommendation>
106
-
107
- **Would you like me to implement this fix?**
108
- ```
109
-
110
- **STOP here** unless the user asks you to proceed with the fix.
111
-
112
- ## Step 4: Determine Fix Strategy
113
-
114
- | Scenario | Strategy | Commit Type |
115
- | --- | --- | --- |
116
- | **Production code bug** (test caught a real bug) | Fix production code using the development-workflow TDD process. The failing test is the RED step. | `fix(component): <description>` |
117
- | **Test needs updating** (intentional API change) | Get user confirmation first. Update test assertions. | `test(component): update test for <change>` |
118
- | **Flaky test** (non-determinism) | Make test deterministic. Run 20+ times to verify. | `test(component): fix flaky test in <test_name>` |
119
- | **Missing test coverage** | Add tests using the development-workflow TDD process. | `test(component): add tests for <feature>` |
120
- | **Test refactoring** | Improve readability/reduce duplication. Keep tests green. | `refactor(test): improve <test_name>` |
121
- | **Environment/setup issue** | Fix environment, document requirements. No code commit needed. | — |
122
-
123
- **CRITICAL:** Get user confirmation before modifying existing tests.
124
-
125
- ## Step 5: Verify Test Fix
126
-
127
- ```bash
128
- # Run the specific test
129
- bundle exec rspec <spec_file>
130
-
131
- # For flaky test fixes, run many times
132
- for i in {1..50}; do
133
- echo "Run $i"
134
- bundle exec rspec <spec_file> || break
135
- done
136
-
137
- # Run full suite
138
- bundle exec rake default
139
- ```
140
-
141
- ## Project-Specific Considerations
142
-
143
- **Test framework:** This project uses RSpec exclusively (`spec/unit/` and
144
- `spec/integration/`).
145
-
146
- **Test helpers:** Use the `'in an empty repository'` shared context (and other
147
- `spec/support/contexts/` shared contexts) plus `Git::IntegrationTestHelpers` methods
148
- (e.g. `write_file`) for integration specs. Use `let`/`let!` and verifying doubles for
149
- unit specs — see [RSpec Unit Testing Standards](../rspec-unit-testing-standards/SKILL.md).
150
-
151
- **Mocking:** The project uses RSpec doubles (`instance_double`, `class_double`) for
152
- unit specs. Be careful with stubs — they can mask real issues.
153
-
154
- **Test data:** Integration specs create temporary repos on the fly (e.g. via
155
- `Dir.mktmpdir` and the shared contexts above). Static fixture files in
156
- `spec/support/fixtures/` exist for a small number of specs that need pre-built
157
- content (e.g. `spec/integration/git/command_line_spec.rb`); prefer dynamic helpers
158
- for new specs. Clean up any state created outside those helpers.
159
-
160
- **CI vs. local differences:** If tests pass locally but fail in CI, use the
161
- ci-cd-troubleshooting skill.