git 1.19.1 → 4.4.5

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 (76) hide show
  1. checksums.yaml +4 -4
  2. data/.commitlintrc.yml +38 -0
  3. data/.github/copilot-instructions.md +2733 -0
  4. data/.github/pull_request_template.md +17 -0
  5. data/.github/workflows/continuous_integration.yml +92 -21
  6. data/.github/workflows/enforce_conventional_commits.yml +29 -0
  7. data/.github/workflows/experimental_continuous_integration.yml +59 -0
  8. data/.github/workflows/release.yml +53 -0
  9. data/.gitignore +5 -0
  10. data/.husky/commit-msg +1 -0
  11. data/.release-please-manifest.json +3 -0
  12. data/.rubocop.yml +55 -0
  13. data/.rubocop_todo.yml +12 -0
  14. data/.yardopts +4 -1
  15. data/AI_POLICY.md +24 -0
  16. data/CHANGELOG.md +501 -0
  17. data/CODE_OF_CONDUCT.md +25 -0
  18. data/CONTRIBUTING.md +323 -102
  19. data/GOVERNANCE.md +106 -0
  20. data/LICENSE +1 -1
  21. data/MAINTAINERS.md +17 -4
  22. data/README.md +575 -246
  23. data/Rakefile +13 -55
  24. data/git.gemspec +36 -30
  25. data/lib/git/args_builder.rb +111 -0
  26. data/lib/git/author.rb +9 -7
  27. data/lib/git/base.rb +602 -173
  28. data/lib/git/branch.rb +318 -38
  29. data/lib/git/branches.rb +21 -24
  30. data/lib/git/command_line.rb +330 -0
  31. data/lib/git/command_line_result.rb +9 -3
  32. data/lib/git/config.rb +10 -6
  33. data/lib/git/diff.rb +149 -81
  34. data/lib/git/diff_path_status.rb +46 -0
  35. data/lib/git/diff_stats.rb +59 -0
  36. data/lib/git/errors.rb +212 -0
  37. data/lib/git/escaped_path.rb +2 -2
  38. data/lib/git/fsck_object.rb +48 -0
  39. data/lib/git/fsck_result.rb +121 -0
  40. data/lib/git/index.rb +2 -1
  41. data/lib/git/lib.rb +1648 -643
  42. data/lib/git/log.rb +143 -106
  43. data/lib/git/object.rb +151 -125
  44. data/lib/git/path.rb +23 -16
  45. data/lib/git/remote.rb +5 -4
  46. data/lib/git/repository.rb +2 -2
  47. data/lib/git/stash.rb +11 -12
  48. data/lib/git/stashes.rb +16 -15
  49. data/lib/git/status.rb +104 -143
  50. data/lib/git/url.rb +3 -3
  51. data/lib/git/version.rb +3 -1
  52. data/lib/git/working_directory.rb +2 -0
  53. data/lib/git/worktree.rb +6 -5
  54. data/lib/git/worktrees.rb +6 -6
  55. data/lib/git.rb +131 -28
  56. data/package.json +10 -0
  57. data/redesign/1_architecture_existing.md +66 -0
  58. data/redesign/2_architecture_redesign.md +130 -0
  59. data/redesign/3_architecture_implementation.md +138 -0
  60. data/redesign/index.md +34 -0
  61. data/release-please-config.json +36 -0
  62. data/tasks/gem_tasks.rake +10 -0
  63. data/tasks/rubocop.rake +12 -0
  64. data/tasks/test.rake +13 -0
  65. data/tasks/test_gem.rake +12 -0
  66. data/tasks/yard.rake +23 -0
  67. metadata +114 -37
  68. data/.github/stale.yml +0 -25
  69. data/Dockerfile.changelog-rs +0 -12
  70. data/PULL_REQUEST_TEMPLATE.md +0 -9
  71. data/RELEASING.md +0 -70
  72. data/lib/git/base/factory.rb +0 -99
  73. data/lib/git/failed_error.rb +0 -53
  74. data/lib/git/git_execute_error.rb +0 -7
  75. data/lib/git/signaled_error.rb +0 -50
  76. /data/{ISSUE_TEMPLATE.md → .github/issue_template.md} +0 -0
@@ -0,0 +1,66 @@
1
+ # Analysis of the Current Git Gem Architecture and Its Challenges
2
+
3
+ This document provides an in-depth look at the current architecture of the `git` gem, outlining its primary components and the design challenges that have emerged over time. Understanding these challenges is the key motivation for the proposed architectural redesign.
4
+
5
+ - [1. Overview of the Current Architecture](#1-overview-of-the-current-architecture)
6
+ - [2. Key Architectural Challenges](#2-key-architectural-challenges)
7
+ - [A. Unclear Separation of Concerns](#a-unclear-separation-of-concerns)
8
+ - [B. Circular Dependency](#b-circular-dependency)
9
+ - [C. Undefined Public API Boundary](#c-undefined-public-api-boundary)
10
+ - [D. Slow and Brittle Test Suite](#d-slow-and-brittle-test-suite)
11
+
12
+ ## 1. Overview of the Current Architecture
13
+
14
+ The gem's current design is centered around three main classes: `Git`, `Git::Base`, and `Git::Lib`.
15
+
16
+ - **`Git` (Top-Level Module)**: This module serves as the primary public entry point for creating repository objects. It contains class-level factory methods like `Git.open`, `Git.clone`, and `Git.init`. It also provides an interface for accessing global git configuration settings.
17
+
18
+ **`Git::Base`**: This is the main object that users interact with after creating or opening a repository. It holds the high-level public API for most git operations (e.g., `g.commit`, `g.add`, `g.status`). It is responsible for managing the repository's state, such as the paths to the working directory and the `.git` directory.
19
+
20
+ **`Git::Lib`**: This class is intended to be the low-level wrapper around the `git` command-line tool. It contains the methods that build the specific command-line arguments and execute the `git` binary. In practice, it also contains a significant amount of logic for parsing the output of these commands.
21
+
22
+ ## 2. Key Architectural Challenges
23
+
24
+ While this structure has been functional, several significant design challenges make the codebase difficult to maintain, test, and evolve.
25
+
26
+ ### A. Unclear Separation of Concerns
27
+
28
+ The responsibilities between Git::Base and Git::Lib are "muddy" and overlap significantly.
29
+
30
+ - `Git::Base` sometimes contains logic that feels like it should be lower-level.
31
+
32
+ - `Git::Lib`, which should ideally only be concerned with command execution, is filled with high-level logic for parsing command output into specific Ruby objects (e.g., parsing log output, diff stats, and branch lists).
33
+
34
+ This blending of responsibilities makes it hard to determine where a specific piece of logic should reside, leading to an inconsistent and confusing internal structure.
35
+
36
+ ### B. Circular Dependency
37
+
38
+ This is the most critical architectural flaw in the current design.
39
+
40
+ - A `Git::Base` instance is created.
41
+
42
+ - The first time a command is run, `Git::Base` lazily initializes a `Git::Lib` instance via its `.lib` accessor method.
43
+
44
+ - The `Git::Lib` constructor is passed the `Git::Base` instance (`self`) so that it can read the repository's path configuration back from the object that is creating it.
45
+
46
+ This creates a tight, circular coupling: `Git::Base` depends on `Git::Lib` to execute commands, but `Git::Lib` depends on `Git::Base` for its own configuration. This pattern makes the classes difficula to instantiate or test in isolation and creates a fragile system where changes in one class can have unexpected side effects in the other.
47
+
48
+ ### C. Undefined Public API Boundary
49
+
50
+ The gem lacks a formally defined public interface. Because `Git::Base` exposes its internal `Git::Lib` instance via the public `g.lib` accessor, many users have come to rely on `Git::Lib` and its methods as if they were part of the public API.
51
+
52
+ This has two negative consequences:
53
+
54
+ 1. It prevents the gem's maintainers from refactoring or changing the internal implementation of `Git::Lib` without causing breaking changes for users.
55
+
56
+ 2. It exposes complex, internal methods to users, creating a confusing and inconsistent user experience.
57
+
58
+ ### D. Slow and Brittle Test Suite
59
+
60
+ The current testing strategy, built on `TestUnit`, suffers from two major issues:
61
+
62
+ - **Over-reliance on Fixtures**: Most tests depend on having a complete, physical git repository on the filesystem to run against. Managing these fixtures is cumbersome.
63
+
64
+ - **Excessive Shelling Out**: Because the logic for command execution and output parsing are tightly coupled, nearly every test must shell out to the actual `git` command-line tool.
65
+
66
+ This makes the test suite extremely slow, especially on non-UNIX platforms like Windows where process creation is more expensive. The slow feedback loop discourages frequent testing and makes development more difficult. The brittleness of filesystem-dependent tests also leads to flickering or unreliable test runs.
@@ -0,0 +1,130 @@
1
+ # Proposed Redesigned Architecture for the Git Gem
2
+
3
+ This document outlines a proposal for a major redesign of the git gem, targeted for version 5.0.0. The goal of this redesign is to modernize the gem's architecture, making it more robust, maintainable, testable, and easier for new contributors to understand.
4
+
5
+ - [1. Motivation](#1-motivation)
6
+ - [2. The New Architecture: A Three-Layered Approach](#2-the-new-architecture-a-three-layered-approach)
7
+ - [3. Key Design Principles](#3-key-design-principles)
8
+ - [A. Clear Public vs. Private API](#a-clear-public-vs-private-api)
9
+ - [B. Dependency Injection](#b-dependency-injection)
10
+ - [C. Immutable Return Values](#c-immutable-return-values)
11
+ - [D. Clear Naming for Path Objects](#d-clear-naming-for-path-objects)
12
+ - [4. Testing Strategy Overhaul](#4-testing-strategy-overhaul)
13
+ - [5. Impact on Users: Breaking Changes for v5.0.0](#5-impact-on-users-breaking-changes-for-v500)
14
+
15
+ ## 1. Motivation
16
+
17
+ The current architecture, while functional, has several design issues that have accrued over time, making it difficult to extend and maintain.
18
+
19
+ - **Unclear Separation of Concerns**: The responsibilities of the `Git`, `Git::Base`, and `Git::Lib` classes are "muddy." `Git::Base` acts as both a high-level API and a factory, while `Git::Lib` contains a mix of low-level command execution and high-level output parsing.
20
+
21
+ - **Circular Dependency**: A key architectural flaw is the circular dependency between `Git::Base` and `Git::Lib`. `Git::Base` creates and depends on `Git::Lib`, but `Git::Lib`'s constructor requires an instance of Git::Base to access configuration. This tight coupling makes the classes difficult to reason about and test in isolation.
22
+
23
+ - **Undefined Public API**: The boundary between the gem's public API and its internal implementation is not clearly defined. This has led some users to rely on internal classes like `Git::Lib`, making it difficult to refactor the internals without introducing breaking changes.
24
+
25
+ - **Slow and Brittle Test Suite**: The current tests rely heavily on filesystem fixtures and shelling out to the git command line for almost every test case. This makes the test suite slow and difficult to maintain, especially on non-UNIX platforms.
26
+
27
+ ## 2. The New Architecture: A Three-Layered Approach
28
+
29
+ The new design is built on a clear separation of concerns, dividing responsibilities into three distinct layers: a Facade, an Execution Context, and Command Objects.
30
+
31
+ 1. The Facade Layer: Git::Repository
32
+
33
+ This is the primary public interface that users will interact with.
34
+
35
+ **Renaming**: `Git::Base` will be renamed to `Git::Repository`. This name is more descriptive and intuitive.
36
+
37
+ **Responsibility**: It will serve as a clean, high-level facade for all common git operations. Its methods will be simple, one-line calls that delegate the actual work to an appropriate command object.
38
+
39
+ **Scalability**: To prevent this class from growing too large, its methods will be organized into logical modules (e.g., `Git::Repository::Branching`, `Git::Repository::History`) which are then included in the main class. This keeps the core class definition small and the features well-organized. These categories will be inspired by (but not slavishly follow) the git command line reference in [this page](https://git-scm.com/docs).
40
+
41
+ 2. The Execution Layer: Git::ExecutionContext
42
+
43
+ This is the low-level, private engine for running commands.
44
+
45
+ **Renaming**: `Git::Lib` will be renamed to `Git::ExecutionContext`.
46
+
47
+ **Responsibility**: Its sole purpose is to execute raw git commands. It will manage the repository's environment (working directory, .git path, logger) and use the existing `Git::CommandLine` class to interact with the system's git binary. It will have no knowledge of any specific git command's arguments or output.
48
+
49
+ 3. The Logic Layer: Git::Commands
50
+
51
+ This is where all the command-specific implementation details will live.
52
+
53
+ **New Classes**: For each git operation, a new command class will be created within the `Git::Commands` namespace (e.g., `Git::Commands::Commit`, `Git::Commands::Diff`).
54
+
55
+ **Dual Responsibility**: Each command class will be responsible for:
56
+
57
+ 1. **Building Arguments**: Translating high-level Ruby options into the specific command-line flags and arguments that git expects.
58
+
59
+ 2. **Parsing Output**: Taking the raw string output from the ExecutionContext and converting it into rich, structured Ruby objects.
60
+
61
+ **Handling Complexity**: For commands with multiple behaviors (like git diff), we can use specialized subclasses (e.g., Git::Commands::Diff::NameStatus, Git::Commands::Diff::Stats) to keep each class focused on a single responsibility.
62
+
63
+ ## 3. Key Design Principles
64
+
65
+ The new architecture will be guided by the following modern design principles.
66
+
67
+ ### A. Clear Public vs. Private API
68
+
69
+ A primary goal of this redesign is to establish a crisp boundary between the public API and internal implementation details.
70
+
71
+ - **Public Interface**: The public API will consist of the `Git` module (for factories), the `Git::Repository` class, and the specialized data/query objects it returns (e.g., `Git::Log`, `Git::Status`, `Git::Object::Commit`).
72
+
73
+ - **Private Implementation**: All other components, including `Git::ExecutionContext` and all classes within the `Git::Commands` namespace, will be considered internal. They will be explicitly marked with the `@api private` YARD tag to discourage external use.
74
+
75
+ ### B. Dependency Injection
76
+
77
+ The circular dependency will be resolved by implementing a clear, one-way dependency flow.
78
+
79
+ 1. The factory methods (`Git.open`, `Git.clone`) will create and configure an instance of `Git::ExecutionContext`.
80
+
81
+ 2. This `ExecutionContext` instance will then be injected into the constructor of the `Git::Repository` object.
82
+
83
+ This decouples the `Repository` from its execution environment, making the system more modular and easier to test.
84
+
85
+ ### C. Immutable Return Values
86
+
87
+ To create a more predictable and robust API, methods will return structured, immutable data objects instead of raw strings or hashes.
88
+
89
+ This will be implemented using `Data.define` or simple, frozen `Struct`s.
90
+
91
+ For example, instead of returning a raw string, `repo.config('user.name')` will return a `Git::Config::Value` object containing the key, value, scope, and source path.
92
+
93
+ ### D. Clear Naming for Path Objects
94
+
95
+ To improve clarity, all classes that represent filesystem paths will be renamed to follow a consistent `...Path` suffix convention.
96
+
97
+ - `Git::WorkingDirectory` -> `Git::WorkingTreePath`
98
+
99
+ - `Git::Index` -> `Git::IndexPath`
100
+
101
+ - The old `Git::Repository` (representing the .git directory/file) -> `Git::RepositoryPath`
102
+
103
+ ## 4. Testing Strategy Overhaul
104
+
105
+ The test suite will be modernized to be faster, more reliable, and easier to work with.
106
+
107
+ - **Migration to RSpec**: The entire test suite will be migrated from TestUnit to RSpec to leverage its modern tooling and expressive DSL.
108
+
109
+ - **Layered Testing**: A three-layered testing strategy will be adopted:
110
+
111
+ 1. **Unit Tests**: The majority of tests will be fast, isolated unit tests for the `Command` classes, using mock `ExecutionContexts`.
112
+
113
+ 2. **Integration Tests**: A small number of integration tests will verify that `ExecutionContext` correctly interacts with the system's `git` binary.
114
+
115
+ 3. **Feature Tests**: A minimal set of high-level tests will ensure the public facade on `Git::Repository` works end-to-end.
116
+
117
+ - **Reduced Filesystem Dependency**: This new structure will dramatically reduce the suite's reliance on slow and brittle filesystem fixtures.
118
+
119
+ ## 5. Impact on Users: Breaking Changes for v5.0.0
120
+
121
+ This redesign is a significant undertaking and will be released as version 5.0.0. It includes several breaking changes that users will need to be aware of when upgrading.
122
+
123
+ - **`Git::Lib` is Removed**: Any code directly referencing `Git::Lib` will break.
124
+
125
+ - **g.lib Accessor is Removed**: The `.lib` accessor on repository objects will be removed.
126
+
127
+ - **Internal Methods Relocated**: Methods that were previously accessible via g.lib will now be private implementation details of the new command classes and will not be directly reachable.
128
+
129
+ Users should only rely on the newly defined public interface.
130
+
@@ -0,0 +1,138 @@
1
+ # Implementation Plan for Git Gem Redesign (v5.0.0)
2
+
3
+ This document outlines a step-by-step plan to implement the proposed architectural redesign. The plan is structured to be incremental, ensuring that the gem remains functional and passes its test suite after each major step. This approach minimizes risk and allows for a gradual, controlled migration to the new architecture.
4
+
5
+ - [Phase 1: Foundation and Scaffolding](#phase-1-foundation-and-scaffolding)
6
+ - [Phase 2: The Strangler Fig Pattern - Migrating Commands](#phase-2-the-strangler-fig-pattern---migrating-commands)
7
+ - [Phase 3: Refactoring the Public Interface](#phase-3-refactoring-the-public-interface)
8
+ - [Phase 4: Final Cleanup and Release Preparation](#phase-4-final-cleanup-and-release-preparation)
9
+
10
+ ## Phase 1: Foundation and Scaffolding
11
+
12
+ ***Goal**: Set up the new file structure and class names without altering existing logic. The gem will be fully functional after this phase.*
13
+
14
+ 1. **Create New Directory Structure**:
15
+
16
+ - Create the new directories that will house the refactored components:
17
+
18
+ - `lib/git/commands/`
19
+
20
+ - `lib/git/repository/` (for the facade modules)
21
+
22
+ 2. **Rename Path Classes**:
23
+
24
+ - Perform a project-wide, safe rename of the existing path-related classes. This is a low-risk mechanical change.
25
+
26
+ - `Git::WorkingDirectory` -> `Git::WorkingTreePath`
27
+
28
+ - `Git::Index` -> `Git::IndexPath`
29
+
30
+ - `Git::Repository` -> `Git::RepositoryPath`
31
+
32
+ - Run the test suite to ensure everything still works as expected.
33
+
34
+ 3. **Introduce New Core Classes (Empty Shells)**:
35
+
36
+ - Create the new `Git::ExecutionContext` class in `lib/git/execution_context.rb`. For now, its implementation can be a simple shell or a thin wrapper around the existing `Git::Lib`.
37
+
38
+ - Create the new `Git::Repository` class in `lib/git/repository.rb`. This will initially be an empty class.
39
+
40
+ 4. **Set Up RSpec Environment**:
41
+
42
+ - Add rspec dependencies to the `Gemfile` as a development dependency.
43
+
44
+ - Configure the test setup to allow both TestUnit and RSpec tests to run concurrently.
45
+
46
+ ## Phase 2: The Strangler Fig Pattern - Migrating Commands
47
+
48
+ ***Goal**: Incrementally move the implementation of each git command from `Git::Lib` to a new `Command` class, strangling the old implementation one piece at a time using a Test-Driven Development workflow.*
49
+
50
+ - **1. Migrate the First Command (`config`)**:
51
+
52
+ - **Write Unit Tests First**: Write comprehensive RSpec unit tests for the *proposed* `Git::Commands::Config` class. These tests will fail initially because the class doesn't exist yet. The tests should be fast and mock the `ExecutionContext`.
53
+
54
+ - **Create Command Class**: Implement `Git::Commands::Config` to make the tests pass. This class will contain all the logic for building git config arguments and parsing its output. It will accept an `ExecutionContext` instance in its constructor.
55
+
56
+ - **Delegate from `Git::Lib`**: Modify the `config_*` methods within the existing `Git::Lib` class. Instead of containing the implementation, they will now instantiate and call the new `Git::Commands::Config` object.
57
+
58
+ - **Verify**: Run the full test suite (both TestUnit and RSpec). The existing tests for `g.config` should still pass, but they will now be executing the new, refactored code.
59
+
60
+ - **2. Incrementally Migrate Remaining Commands:**
61
+
62
+ - Repeat the process from the previous step for all other commands, one by one or in logical groups (e.g., all `diff` related commands, then all `log` commands).
63
+
64
+ - For each command (`add`, `commit`, `log`, `diff`, `status`, etc.):
65
+
66
+ 1. Create the corresponding Git::Commands::* class.
67
+
68
+ 2. Write isolated RSpec unit tests for the new class.
69
+
70
+ 3. Change the method in Git::Lib to delegate to the new command object.
71
+
72
+ 4. Run the full test suite to ensure no regressions have been introduced.
73
+
74
+ ## Phase 3: Refactoring the Public Interface
75
+
76
+ ***Goal**: Switch the public-facing classes to use the new architecture directly, breaking the final ties to the old implementation.*
77
+
78
+ 1. **Refactor Factory Methods**:
79
+
80
+ - Modify the factory methods in the top-level `Git` module (`.open`, `.clone`, etc.).
81
+
82
+ - These methods will now be responsible for creating an instance of `Git::ExecutionContext` and injecting it into the constructor of a `Git::Repository` object.
83
+
84
+ The return value of these factories will now be a `Git::Repository` instance, not a `Git::Base` instance.
85
+
86
+ 2. **Implement the Facade**:
87
+
88
+ - Populate the `Git::Repository` class with the simple, one-line facade methods that delegate to the `Command` objects. For example:
89
+
90
+ ```ruby
91
+ def commit(msg)
92
+ Git::Commands::Commit.new(@execution_context, msg).run
93
+ end
94
+ ```
95
+
96
+ - Organize these facade methods into modules as planned (`lib/git/repository/branching.rb`, etc.) and include them in the main `Git::Repository` class.
97
+
98
+ 3. **Deprecate and Alias `Git::Base`**:
99
+
100
+ - To maintain a degree of backward compatibility through the transition, make `Git::Base` a deprecated constant that points to `Git::Repository`.
101
+
102
+ ```ruby
103
+ Git::Base = ActiveSupport::Deprecation::DeprecatedConstantProxy.new(
104
+ 'Git::Base',
105
+ 'Git::Repository',
106
+ Git::Deprecation
107
+ )
108
+ ```
109
+
110
+ - This ensures that any user code checking `is_a?(Git::Base)` will not immediately break.
111
+
112
+ ## Phase 4: Final Cleanup and Release Preparation
113
+
114
+ ***Goal**: Remove all old code, finalize the test suite, and prepare for the v5.0.0 release.*
115
+
116
+ 1. **Remove Old Code**:
117
+
118
+ - Delete the `Git::Lib` class entirely.
119
+
120
+ - Delete the `Git::Base` class file and remove the deprecation proxy.
121
+
122
+ - Remove any other dead code that was part of the old implementation.
123
+
124
+ 2. **Finalize Test Suite**:
125
+
126
+ - Convert any remaining, relevant TestUnit tests to RSpec.
127
+
128
+ - Remove the `test-unit` dependency from the `Gemfile`.
129
+
130
+ - Ensure the RSpec suite has comprehensive coverage for the new architecture.
131
+
132
+ 3. **Update Documentation**:
133
+
134
+ - Thoroughly document the new public API (`Git`, `Git::Repository`, etc.).
135
+
136
+ - Mark all internal classes (`ExecutionContext`, `Commands`, `*Path`) with `@api private` in the YARD documentation.
137
+
138
+ - Update the `README.md` and create a `UPGRADING.md` guide explaining the breaking changes for v5.0.0.
data/redesign/index.md ADDED
@@ -0,0 +1,34 @@
1
+ # Architectural Redesign Project
2
+
3
+ [This project was announced in the project's README](../README.md#2025-07-09-architectural-redesign)
4
+
5
+ The git gem is undergoing a significant architectural redesign for the upcoming
6
+ v5.0.0 release. The current architecture has several design challenges that make it
7
+ difficult to maintain and evolve. This redesign aims to address these issues by
8
+ introducing a clearer, more robust, and more testable structure.
9
+
10
+ We have prepared detailed documents outlining the analysis of the current
11
+ architecture and the proposed changes. We encourage our community and contributors to
12
+ review them:
13
+
14
+ 1. [Analysis of the Current Architecture](1_architecture_existing.md): A
15
+ breakdown of the existing design and its challenges.
16
+ 2. [The Proposed Redesign](2_architecture_redesign.md): An overview of the
17
+ new three-layered architecture.
18
+ 3. [Implementation Plan](3_architecture_implementation.md): The step-by-step
19
+ plan for implementing the redesign.
20
+
21
+ Your feedback is welcome! Please feel free to open an issue to discuss the proposed
22
+ changes.
23
+
24
+ > **DON'T PANIC!**
25
+ >
26
+ > While this is a major internal refactoring, our goal is to keep the primary public
27
+ API on the main repository object as stable as possible. Most users who rely on
28
+ documented methods like `g.commit`, `g.add`, and `g.status` should find the
29
+ transition to v5.0.0 straightforward.
30
+ >
31
+ > The breaking changes will primarily affect users who have been relying on the
32
+ internal g.lib accessor, which will be removed as part of this cleanup. For more
33
+ details, please see the "Impact on Users" section in [the redesign
34
+ > document](2_architecture_redesign.md).
@@ -0,0 +1,36 @@
1
+ {
2
+ "bootstrap-sha": "31374263eafea4e23352494ef4f6bea3ce62c1b5",
3
+ "packages": {
4
+ ".": {
5
+ "release-type": "ruby",
6
+ "package-name": "git",
7
+ "changelog-path": "CHANGELOG.md",
8
+ "version-file": "lib/git/version.rb",
9
+ "bump-minor-pre-major": true,
10
+ "bump-patch-for-minor-pre-major": true,
11
+ "draft": false,
12
+ "prerelease": false,
13
+ "include-component-in-tag": false,
14
+ "pull-request-title-pattern": "chore: release v${version}",
15
+ "changelog-sections": [
16
+ { "type": "feat", "section": "Features", "hidden": false },
17
+ { "type": "fix", "section": "Bug Fixes", "hidden": false },
18
+ { "type": "build", "section": "Other Changes", "hidden": false },
19
+ { "type": "chore", "section": "Other Changes", "hidden": false },
20
+ { "type": "ci", "section": "Other Changes", "hidden": false },
21
+ { "type": "docs", "section": "Other Changes", "hidden": false },
22
+ { "type": "perf", "section": "Other Changes", "hidden": false },
23
+ { "type": "refactor", "section": "Other Changes", "hidden": false },
24
+ { "type": "revert", "section": "Other Changes", "hidden": false },
25
+ { "type": "style", "section": "Other Changes", "hidden": false },
26
+ { "type": "test", "section": "Other Changes", "hidden": false }
27
+ ]
28
+ }
29
+ },
30
+ "plugins": [
31
+ {
32
+ "type": "sentence-case"
33
+ }
34
+ ],
35
+ "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
36
+ }
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+
5
+ # Make it so that calling `rake release` just calls `rake release:rubygem_push` to
6
+ # avoid creating and pushing a new tag.
7
+
8
+ Rake::Task['release'].clear
9
+ desc 'Customized release task to avoid creating a new tag'
10
+ task release: 'release:rubygem_push'
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ # RuboCop analyzes source text, so its verdict is fixed by TargetRubyVersion in
4
+ # .rubocop.yml, not by the host Ruby. Skipping it on JRuby and TruffleRuby loses no
5
+ # coverage (the MRI matrix jobs lint the same files) and avoids RuboCop internal
6
+ # cop errors on TruffleRuby.
7
+ #
8
+ unless RUBY_PLATFORM == 'java' || RUBY_ENGINE == 'truffleruby'
9
+ require 'rubocop/rake_task'
10
+
11
+ RuboCop::RakeTask.new
12
+ end
data/tasks/test.rake ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ desc 'Run Unit Tests'
4
+ task :test do
5
+ sh 'ruby bin/test'
6
+
7
+ # You can run individual test files (or multiple files) from the command
8
+ # line with:
9
+ #
10
+ # $ bin/test test_archive.rb
11
+ #
12
+ # $ bin/test test_archive.rb test_object.rb
13
+ end
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'English'
4
+
5
+ desc 'Build and install the git gem and run a sanity check'
6
+ task 'test:gem': :install do
7
+ output = `ruby -e "require 'git'; g = Git.open('.'); puts g.log.size"`.chomp
8
+ raise 'Gem test failed' unless $CHILD_STATUS.success?
9
+ raise 'Expected gem test to return an integer' unless output =~ /^\d+$/
10
+
11
+ puts 'Gem Test Succeeded'
12
+ end
data/tasks/yard.rake ADDED
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ # YARD documentation for this project can NOT be built with JRuby or TruffleRuby.
4
+ # This project uses the redcarpet gem which can not be installed on JRuby.
5
+ #
6
+ unless RUBY_PLATFORM == 'java' || RUBY_ENGINE == 'truffleruby'
7
+ require 'yard'
8
+
9
+ YARD::Rake::YardocTask.new
10
+ CLEAN << '.yardoc'
11
+ CLEAN << 'doc'
12
+
13
+ require 'yardstick/rake/verify'
14
+ Yardstick::Rake::Verify.new(:'yardstick:coverage') do |t|
15
+ t.threshold = 50
16
+ t.require_exact_threshold = false
17
+ end
18
+
19
+ desc 'Run yardstick to check yard docs'
20
+ task :yardstick do
21
+ sh "yardstick 'lib/**/*.rb'"
22
+ end
23
+ end