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,17 @@
1
+ Review our [guidelines for contributing](https://github.com/ruby-git/ruby-git/blob/main/CONTRIBUTING.md) to this repository. A good start is to:
2
+
3
+ - Write tests for your changes
4
+ - Run `rake` before pushing
5
+ - Include / update docs in the README.md and in YARD documentation
6
+
7
+ # Description
8
+
9
+ \<your description here\>
10
+
11
+ ## Checklist
12
+
13
+ - [ ] I reviewed and applied the project's [AI Policy](../AI_POLICY.md). I understand
14
+ and verify any AI-assisted changes included in this PR and ensured they meet
15
+ quality, security, and licensing standards.
16
+ - [ ] Tests added/updated as needed and `rake` passes locally.
17
+ - [ ] Documentation updated where applicable (README and/or YARD).
@@ -1,40 +1,46 @@
1
1
  name: CI
2
2
 
3
3
  on:
4
- push:
5
- branches: [master]
6
4
  pull_request:
7
- branches: [master]
5
+ branches: [main, 4.x]
8
6
  workflow_dispatch:
9
7
 
10
8
  jobs:
11
- continuous_integration_build:
12
- continue-on-error: true
9
+ build:
10
+ name: Ruby ${{ matrix.ruby }} on ${{ matrix.operating-system }}
11
+
12
+ # Skip this job if triggered by a release PR
13
+ if: >-
14
+ github.event_name == 'workflow_dispatch' ||
15
+ (github.event_name == 'pull_request' && !startsWith(github.event.pull_request.head.ref, 'release-please--'))
16
+
17
+ runs-on: ${{ matrix.operating-system }}
18
+ continue-on-error: ${{ matrix.experimental == 'Yes' }}
19
+ env: { JAVA_OPTS: -Djdk.io.File.enableADS=true }
20
+
13
21
  strategy:
14
22
  fail-fast: false
15
23
  matrix:
16
- ruby: [2.7, 3.0, 3.1, 3.2]
24
+ # Only the latest versions of JRuby and TruffleRuby are tested
25
+ ruby: ["3.2", "3.4", "4.0", "truffleruby-24.2.1", "jruby-10.0.0.1"]
17
26
  operating-system: [ubuntu-latest]
27
+ experimental: [No]
28
+ java_version: [""]
18
29
  include:
19
- - ruby: head
20
- operating-system: ubuntu-latest
21
- - ruby: truffleruby-head
22
- operating-system: ubuntu-latest
23
- - ruby: 2.7
30
+ - ruby: 3.2
24
31
  operating-system: windows-latest
25
- - ruby: jruby-head
26
- operating-system: windows-latest
27
-
28
- name: Ruby ${{ matrix.ruby }} on ${{ matrix.operating-system }}
29
-
30
- runs-on: ${{ matrix.operating-system }}
31
-
32
- env:
33
- JAVA_OPTS: -Djdk.io.File.enableADS=true
32
+ experimental: No
34
33
 
35
34
  steps:
36
35
  - name: Checkout Code
37
- uses: actions/checkout@v3
36
+ uses: actions/checkout@v4
37
+
38
+ - name: Setup Java
39
+ if: matrix.java_version != ''
40
+ uses: actions/setup-java@v4
41
+ with:
42
+ distribution: 'temurin'
43
+ java-version: ${{ matrix.java_version }}
38
44
 
39
45
  - name: Setup Ruby
40
46
  uses: ruby/setup-ruby@v1
@@ -47,3 +53,68 @@ jobs:
47
53
 
48
54
  - name: Test Gem
49
55
  run: bundle exec rake test:gem
56
+
57
+ # The branch ruleset cannot require the matrix job above directly. A required status
58
+ # check is matched by name, and `build`'s name is a template -- GitHub only expands it
59
+ # into "Ruby 3.2 on ubuntu-latest" and friends when it evaluates the matrix. The
60
+ # job-level `if:` short-circuits before that happens, so a release PR reports one check
61
+ # named literally "Ruby ${{ matrix.ruby }} on ${{ matrix.operating-system }}" and the
62
+ # six expanded names never report at all. Required checks that never report block a PR
63
+ # indefinitely rather than passing, which is what stranded the v5.0.5 release PR on
64
+ # main and the v4.4.1 release PR here.
65
+ #
66
+ # So the ruleset requires this job instead: one stable name, no matrix, no template to
67
+ # expand. It also decouples the required-check list from the matrix, so adding or
68
+ # dropping a Ruby version no longer needs a matching ruleset edit.
69
+ #
70
+ # Unlike main, this branch has no separate lint job: `rake default` runs RuboCop and
71
+ # YARD inside every matrix leg, so this one check covers everything CI does here.
72
+ #
73
+ # This job carries the same release-PR guard as the matrix above, so that a release PR
74
+ # reports it as skipped rather than as a success for specs that never ran. Skipping is
75
+ # safe here and was not safe for `build`: this job's name is a literal string, so the
76
+ # check run exists and reports a skipped conclusion whether or not the job runs, and
77
+ # rulesets treat skipped as passing. A matrix job's name does not exist at all until the
78
+ # matrix is evaluated, which is the whole reason this job exists.
79
+ #
80
+ # `always()` is load-bearing and must stay. Without a status check function a job-level
81
+ # `if:` implies `success()`, so a failing matrix would skip this job -- and a skipped
82
+ # required check counts as passing, meaning a red build would merge. `always()` forces a
83
+ # real verdict on every run that is not a release PR. `!cancelled()` is not a substitute:
84
+ # a cancelled run would then skip the gate, and a skipped conclusion is one rulesets treat
85
+ # as passing -- so a build that never finished would stop blocking the merge.
86
+ #
87
+ # The case below accepts `success` only. `build` and this job now carry the same release-PR
88
+ # guard, so this job runs exactly when `build` ran; a `skipped` result would mean the two
89
+ # guards have drifted apart, and failing closed on it turns that into a loud failure rather
90
+ # than a silent pass.
91
+ #
92
+ # Note that a matrix leg marked `experimental: Yes` carries continue-on-error, and a
93
+ # continue-on-error failure does not fail the job as a whole -- so it does not fail this
94
+ # gate either. That is what `experimental` is for; no leg currently sets it.
95
+ build-complete:
96
+ name: All Specs Passed
97
+
98
+ needs: [build]
99
+
100
+ # Report a verdict on every non-release PR regardless of the matrix result, and skip
101
+ # on release PRs, where the matrix was never meant to run.
102
+ if: >-
103
+ always() &&
104
+ (github.event_name == 'workflow_dispatch' ||
105
+ (github.event_name == 'pull_request' && !startsWith(github.event.pull_request.head.ref, 'release-please--')))
106
+
107
+ runs-on: ubuntu-latest
108
+
109
+ steps:
110
+ - name: Check the result of the build job
111
+ run: |
112
+ case "${{ needs.build.result }}" in
113
+ success)
114
+ echo "build: ${{ needs.build.result }}"
115
+ ;;
116
+ *)
117
+ echo "::error::build: ${{ needs.build.result }}"
118
+ exit 1
119
+ ;;
120
+ esac
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: Conventional Commits
3
+
4
+ permissions:
5
+ contents: read
6
+
7
+ on:
8
+ pull_request:
9
+ branches:
10
+ - main
11
+ - 4.x
12
+
13
+ jobs:
14
+ commit-lint:
15
+ name: Verify Conventional Commits
16
+
17
+ # Skip this job if this is a release PR
18
+ if: (github.event_name == 'pull_request' && !startsWith(github.event.pull_request.head.ref, 'release-please--'))
19
+
20
+ runs-on: ubuntu-latest
21
+
22
+ steps:
23
+ - name: Checkout
24
+ uses: actions/checkout@v4
25
+ with: { fetch-depth: 0 }
26
+
27
+ - name: Check Commit Messages
28
+ uses: wagoid/commitlint-github-action@v6
29
+ with: { configFile: .commitlintrc.yml }
@@ -0,0 +1,59 @@
1
+ name: CI Experimental
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ build:
11
+ name: Ruby ${{ matrix.ruby }} on ${{ matrix.operating-system }}
12
+
13
+ # Skip this job if triggered by pushing a release commit
14
+ if: >-
15
+ github.event_name == 'workflow_dispatch' ||
16
+ (github.event_name == 'push' && !startsWith(github.event.head_commit.message, 'chore: release '))
17
+
18
+ runs-on: ${{ matrix.operating-system }}
19
+ continue-on-error: true
20
+ env: { JAVA_OPTS: -Djdk.io.File.enableADS=true }
21
+
22
+ strategy:
23
+ fail-fast: false
24
+ matrix:
25
+ include:
26
+ - # Building against head version of Ruby is considered experimental
27
+ ruby: head
28
+ operating-system: ubuntu-latest
29
+ experimental: Yes
30
+ java_version: ""
31
+
32
+ - # Since JRuby on Windows is known to not work, consider this experimental
33
+ ruby: jruby-head
34
+ operating-system: windows-latest
35
+ experimental: Yes
36
+ java_version: "21"
37
+
38
+ steps:
39
+ - name: Checkout Code
40
+ uses: actions/checkout@v4
41
+
42
+ - name: Setup Java
43
+ if: matrix.java_version != ''
44
+ uses: actions/setup-java@v4
45
+ with:
46
+ distribution: 'temurin'
47
+ java-version: ${{ matrix.java_version }}
48
+
49
+ - name: Setup Ruby
50
+ uses: ruby/setup-ruby@v1
51
+ with:
52
+ ruby-version: ${{ matrix.ruby }}
53
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
54
+
55
+ - name: Run Build
56
+ run: bundle exec rake default
57
+
58
+ - name: Test Gem
59
+ run: bundle exec rake test:gem
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: Release Gem
3
+
4
+ description: |
5
+ This workflow creates a new release on GitHub and publishes the gem to
6
+ RubyGems.org.
7
+
8
+ The workflow uses the `googleapis/release-please-action` to handle the
9
+ release creation process and the `rubygems/release-gem` action to publish
10
+ the gem to rubygems.org
11
+
12
+ on:
13
+ push:
14
+ branches: ["main", "4.x"]
15
+
16
+ workflow_dispatch:
17
+
18
+ jobs:
19
+ release:
20
+ runs-on: ubuntu-latest
21
+
22
+ environment:
23
+ name: RubyGems
24
+ url: https://rubygems.org/gems/git
25
+
26
+ permissions:
27
+ contents: write
28
+ pull-requests: write
29
+ id-token: write
30
+
31
+ steps:
32
+ - name: Checkout project
33
+ uses: actions/checkout@v4
34
+
35
+ - name: Create release
36
+ uses: googleapis/release-please-action@v4
37
+ id: release
38
+ with:
39
+ token: ${{ secrets.AUTO_RELEASE_TOKEN }}
40
+ config-file: release-please-config.json
41
+ manifest-file: .release-please-manifest.json
42
+ target-branch: ${{ github.ref_name }}
43
+
44
+ - name: Setup ruby
45
+ uses: ruby/setup-ruby@v1
46
+ if: ${{ steps.release.outputs.release_created }}
47
+ with:
48
+ bundler-cache: true
49
+ ruby-version: ruby
50
+
51
+ - name: Push to RubyGems.org
52
+ uses: rubygems/release-gem@v1
53
+ if: ${{ steps.release.outputs.release_created }}
data/.gitignore CHANGED
@@ -8,3 +8,8 @@ doc
8
8
  pkg
9
9
  rdoc
10
10
  Gemfile.lock
11
+ node_modules
12
+ package-lock.json
13
+ ai-prompt.erb
14
+ rubocop-report.json
15
+ git-versions/
data/.husky/commit-msg ADDED
@@ -0,0 +1 @@
1
+ npx --no-install commitlint --edit "$1"
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "4.4.5"
3
+ }
data/.rubocop.yml ADDED
@@ -0,0 +1,55 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ inherit_gem:
4
+ main_branch_shared_rubocop_config: config/rubocop.yml
5
+
6
+ # Don't care about complexity offenses in the TestUnit tests This exclusions
7
+ # will be removed when we switch to RSpec.
8
+ Metrics/CyclomaticComplexity:
9
+ Exclude:
10
+ - "tests/test_helper.rb"
11
+ - "tests/units/**/*"
12
+
13
+ Metrics/ClassLength:
14
+ Exclude:
15
+ - "tests/test_helper.rb"
16
+ - "tests/units/**/*"
17
+
18
+ Metrics/AbcSize:
19
+ Exclude:
20
+ - "tests/test_helper.rb"
21
+ - "tests/units/**/*"
22
+
23
+ # Don't care so much about length of methods in tests
24
+ Metrics/MethodLength:
25
+ Exclude:
26
+ - "tests/test_helper.rb"
27
+ - "tests/units/**/*"
28
+
29
+ # Allow test data to have long lines
30
+ Layout/LineLength:
31
+ Exclude:
32
+ - "tests/test_helper.rb"
33
+ - "tests/units/**/*"
34
+ - "*.gemspec"
35
+
36
+ # Testing and gemspec DSL results in large blocks
37
+ Metrics/BlockLength:
38
+ Exclude:
39
+ - "tests/test_helper.rb"
40
+ - "tests/units/**/*"
41
+ - "*.gemspec"
42
+
43
+ # Don't force every test class to be described
44
+ Style/Documentation:
45
+ Exclude:
46
+ - "tests/units/**/*"
47
+
48
+ Style/OneClassPerFile:
49
+ Exclude:
50
+ - "tests/units/**/*"
51
+
52
+ AllCops:
53
+ # Pin this project to Ruby 3.1 in case the shared config above is upgraded to 3.2
54
+ # or later.
55
+ TargetRubyVersion: 3.2
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,12 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2025-08-17 04:52:22 UTC using RuboCop version 1.79.2.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 2
10
+ # Configuration parameters: CountComments, CountAsOne.
11
+ Metrics/ClassLength:
12
+ Max: 1170
data/.yardopts CHANGED
@@ -6,6 +6,9 @@
6
6
  -
7
7
  README.md
8
8
  CHANGELOG.md
9
+ CODE_OF_CONDUCT.md
9
10
  CONTRIBUTING.md
10
- RELEASING.md
11
+ AI_POLICY.md
12
+ GOVERNANCE.md
11
13
  MAINTAINERS.md
14
+ LICENSE
data/AI_POLICY.md ADDED
@@ -0,0 +1,24 @@
1
+ <!--
2
+ # @markup markdown
3
+ # @title AI Policy
4
+ -->
5
+
6
+ # AI Policy
7
+
8
+ AI assisted contributions are welcome in this project.
9
+
10
+ Reviewing and maintaining code requires human insight. While AI tools can be helpful
11
+ assistants, they are no substitute for human judgment and creativity.
12
+
13
+ We value the unique perspectives and critical thinking that our contributors bring.
14
+ If you use AI tools to assist your work:
15
+
16
+ 1. **You are responsible**: You must review and understand every line of code or text
17
+ you submit.
18
+ 2. **Focus on quality**: Ensure that AI-generated content meets our standards for
19
+ correctness, readability, and security, and respects all licensing requirements.
20
+ 3. **Be transparent**: We encourage you to disclose if significant portions of your
21
+ contribution were AI-generated.
22
+
23
+ Ultimately, the quality of this project depends on *your* expertise. Use tools
24
+ wisely, but lead with your own intelligence.