git 1.19.1 → 3.1.1

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 (52) hide show
  1. checksums.yaml +4 -4
  2. data/.commitlintrc.yml +38 -0
  3. data/.github/pull_request_template.md +8 -0
  4. data/.github/workflows/continuous_integration.yml +19 -21
  5. data/.github/workflows/enforce_conventional_commits.yml +28 -0
  6. data/.github/workflows/experimental_continuous_integration.yml +50 -0
  7. data/.github/workflows/release.yml +52 -0
  8. data/.gitignore +3 -0
  9. data/.husky/commit-msg +1 -0
  10. data/.release-please-manifest.json +3 -0
  11. data/.yardopts +0 -1
  12. data/CHANGELOG.md +211 -0
  13. data/CONTRIBUTING.md +290 -102
  14. data/README.md +180 -62
  15. data/Rakefile +7 -0
  16. data/git.gemspec +11 -11
  17. data/lib/git/author.rb +3 -2
  18. data/lib/git/base.rb +222 -59
  19. data/lib/git/branch.rb +2 -0
  20. data/lib/git/branches.rb +15 -14
  21. data/lib/git/command_line.rb +287 -0
  22. data/lib/git/config.rb +7 -1
  23. data/lib/git/diff.rb +2 -0
  24. data/lib/git/errors.rb +206 -0
  25. data/lib/git/escaped_path.rb +1 -1
  26. data/lib/git/index.rb +2 -1
  27. data/lib/git/lib.rb +604 -234
  28. data/lib/git/log.rb +74 -6
  29. data/lib/git/object.rb +80 -76
  30. data/lib/git/path.rb +9 -8
  31. data/lib/git/remote.rb +2 -0
  32. data/lib/git/repository.rb +2 -0
  33. data/lib/git/stash.rb +7 -6
  34. data/lib/git/stashes.rb +11 -10
  35. data/lib/git/status.rb +135 -25
  36. data/lib/git/version.rb +3 -1
  37. data/lib/git/working_directory.rb +2 -0
  38. data/lib/git/worktree.rb +2 -0
  39. data/lib/git/worktrees.rb +2 -0
  40. data/lib/git.rb +21 -7
  41. data/package.json +10 -0
  42. data/release-please-config.json +36 -0
  43. metadata +52 -38
  44. data/.github/stale.yml +0 -25
  45. data/Dockerfile.changelog-rs +0 -12
  46. data/PULL_REQUEST_TEMPLATE.md +0 -9
  47. data/RELEASING.md +0 -70
  48. data/lib/git/base/factory.rb +0 -99
  49. data/lib/git/failed_error.rb +0 -53
  50. data/lib/git/git_execute_error.rb +0 -7
  51. data/lib/git/signaled_error.rb +0 -50
  52. /data/{ISSUE_TEMPLATE.md → .github/issue_template.md} +0 -0
@@ -1,12 +0,0 @@
1
- FROM rust
2
-
3
- # Build the docker image (from this project's root directory):
4
- # docker build --file Dockerfile.changelog-rs --tag changelog-rs .
5
- #
6
- # Use this image to output a changelog (from this project's root directory):
7
- # docker run --rm --volume "$PWD:/worktree" changelog-rs v1.9.1 v1.10.0
8
-
9
- RUN cargo install changelog-rs
10
- WORKDIR /worktree
11
-
12
- ENTRYPOINT ["/usr/local/cargo/bin/changelog-rs", "/worktree"]
@@ -1,9 +0,0 @@
1
- ### Your checklist for this pull request
2
- 🚨Please review the [guidelines for contributing](https://github.com/ruby-git/ruby-git/blob/master/CONTRIBUTING.md) to this repository.
3
-
4
- - [ ] Ensure all commits include DCO sign-off.
5
- - [ ] Ensure that your contributions pass unit testing.
6
- - [ ] Ensure that your contributions contain documentation if applicable.
7
-
8
- ### Description
9
- Please describe your pull request.
data/RELEASING.md DELETED
@@ -1,70 +0,0 @@
1
- <!--
2
- # @markup markdown
3
- # @title Releasing
4
- -->
5
-
6
- # How to release a new git.gem
7
-
8
- Releasing a new version of the `git` gem requires these steps:
9
-
10
- - [How to release a new git.gem](#how-to-release-a-new-gitgem)
11
- - [Install Prerequisites](#install-prerequisites)
12
- - [Prepare the Release](#prepare-the-release)
13
- - [Review and Merge the Release](#review-and-merge-the-release)
14
- - [Build and Release the Gem](#build-and-release-the-gem)
15
-
16
- These instructions use an example where:
17
-
18
- - The default branch is `master`
19
- - The current release version is `1.5.0`
20
- - You want to create a new *minor* release, `1.6.0`
21
-
22
- ## Install Prerequisites
23
-
24
- The following tools need to be installed in order to create the release:
25
-
26
- - [git](https://git-scm.com) is used to interact with the local and remote repositories
27
- - [gh](https://cli.github.com) is used to create the release and PR in GitHub
28
- - [Docker](https://www.docker.com) is used to run the script to create the release notes
29
-
30
- On a Mac, these tools can be installed using [brew](https://brew.sh):
31
-
32
- ```shell
33
- $ brew install git
34
- ...
35
- $ brew install gh
36
- ...
37
- $ brew install --cask docker
38
- ...
39
- $
40
- ```
41
-
42
- ## Prepare the Release
43
-
44
- Bump the version, create release notes, tag the release and create a GitHub release and PR which can be used to review the release.
45
-
46
- Steps:
47
-
48
- - Check out the code with `git clone https://github.com/ruby-git/ruby-git ruby-git-v1.6.0 && cd ruby-git-v1.6.0`
49
- - Install development dependencies using bundle `bundle install`
50
- - Based upon the nature of the changes, decide on the type of release: `major`, `minor`, or `patch` (in this example we will use `minor`)
51
- - Run the release script `bundle exec create-github-release minor`
52
-
53
- ## Review and Merge the Release
54
-
55
- Have the release PR approved and merge the changes into the `master` branch.
56
-
57
- **IMPORTANT** DO NOT merge to the `master` branch using the GitHub UI. Instead use the instructions below.
58
-
59
- Steps:
60
-
61
- - Get the release PR reviewed and approved in GitHub
62
- - Merge the changes with the command `git checkout master && git merge --ff-only v1.6.0 && git push`
63
-
64
- ## Build and Release the Gem
65
-
66
- Build the gem and publish it to [rubygems.org](https://rubygems.org/gems/git)
67
-
68
- Steps:
69
-
70
- - Build and release the gem using rake `bundle exec rake release`
@@ -1,99 +0,0 @@
1
- module Git
2
-
3
- class Base
4
-
5
- module Factory
6
- # @return [Git::Branch] an object for branch_name
7
- def branch(branch_name = self.current_branch)
8
- Git::Branch.new(self, branch_name)
9
- end
10
-
11
- # @return [Git::Branches] a collection of all the branches in the repository.
12
- # Each branch is represented as a {Git::Branch}.
13
- def branches
14
- Git::Branches.new(self)
15
- end
16
-
17
- # returns a Git::Worktree object for dir, commitish
18
- def worktree(dir, commitish = nil)
19
- Git::Worktree.new(self, dir, commitish)
20
- end
21
-
22
- # returns a Git::worktrees object of all the Git::Worktrees
23
- # objects for this repo
24
- def worktrees
25
- Git::Worktrees.new(self)
26
- end
27
-
28
- # @return [Git::Object::Commit] a commit object
29
- def commit_tree(tree = nil, opts = {})
30
- Git::Object::Commit.new(self, self.lib.commit_tree(tree, opts))
31
- end
32
-
33
- # @return [Git::Diff] a Git::Diff object
34
- def diff(objectish = 'HEAD', obj2 = nil)
35
- Git::Diff.new(self, objectish, obj2)
36
- end
37
-
38
- # @return [Git::Object] a Git object
39
- def gblob(objectish)
40
- Git::Object.new(self, objectish, 'blob')
41
- end
42
-
43
- # @return [Git::Object] a Git object
44
- def gcommit(objectish)
45
- Git::Object.new(self, objectish, 'commit')
46
- end
47
-
48
- # @return [Git::Object] a Git object
49
- def gtree(objectish)
50
- Git::Object.new(self, objectish, 'tree')
51
- end
52
-
53
- # @return [Git::Log] a log with the specified number of commits
54
- def log(count = 30)
55
- Git::Log.new(self, count)
56
- end
57
-
58
- # returns a Git::Object of the appropriate type
59
- # you can also call @git.gtree('tree'), but that's
60
- # just for readability. If you call @git.gtree('HEAD') it will
61
- # still return a Git::Object::Commit object.
62
- #
63
- # object calls a factory method that will run a rev-parse
64
- # on the objectish and determine the type of the object and return
65
- # an appropriate object for that type
66
- #
67
- # @return [Git::Object] an instance of the appropriate type of Git::Object
68
- def object(objectish)
69
- Git::Object.new(self, objectish)
70
- end
71
-
72
- # @return [Git::Remote] a remote of the specified name
73
- def remote(remote_name = 'origin')
74
- Git::Remote.new(self, remote_name)
75
- end
76
-
77
- # @return [Git::Status] a status object
78
- def status
79
- Git::Status.new(self)
80
- end
81
-
82
- # @return [Git::Object::Tag] a tag object
83
- def tag(tag_name)
84
- Git::Object.new(self, tag_name, 'tag', true)
85
- end
86
-
87
- # Find as good common ancestors as possible for a merge
88
- # example: g.merge_base('master', 'some_branch', 'some_sha', octopus: true)
89
- #
90
- # @return [Array<Git::Object::Commit>] a collection of common ancestors
91
- def merge_base(*args)
92
- shas = self.lib.merge_base(*args)
93
- shas.map { |sha| gcommit(sha) }
94
- end
95
- end
96
-
97
- end
98
-
99
- end
@@ -1,53 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'git/git_execute_error'
4
-
5
- module Git
6
- # This error is raised when a git command fails
7
- #
8
- # The git command executed, status, stdout, and stderr are available from this
9
- # object. The #message includes the git command, the status of the process, and
10
- # the stderr of the process.
11
- #
12
- # @api public
13
- #
14
- class FailedError < Git::GitExecuteError
15
- # Create a FailedError object
16
- #
17
- # Since this gem redirects stderr to stdout, the stdout of the process is used.
18
- #
19
- # @example
20
- # `exit 1` # set $? appropriately for this example
21
- # result = Git::CommandLineResult.new(%w[git status], $?, 'stdout', 'stderr')
22
- # error = Git::FailedError.new(result)
23
- # error.message #=>
24
- # "[\"git\", \"status\"]\nstatus: pid 89784 exit 1\noutput: \"stdout\""
25
- #
26
- # @param result [Git::CommandLineResult] the result of the git command including
27
- # the git command, status, stdout, and stderr
28
- #
29
- def initialize(result)
30
- super("#{result.git_cmd}\nstatus: #{result.status}\noutput: #{result.stdout.inspect}")
31
- @result = result
32
- end
33
-
34
- # @attribute [r] result
35
- #
36
- # The result of the git command including the git command and its status and output
37
- #
38
- # @example
39
- # `exit 1` # set $? appropriately for this example
40
- # result = Git::CommandLineResult.new(%w[git status], $?, 'stdout', 'stderr')
41
- # error = Git::FailedError.new(result)
42
- # error.result #=>
43
- # #<Git::CommandLineResult:0x00000001046bd488
44
- # @git_cmd=["git", "status"],
45
- # @status=#<Process::Status: pid 89784 exit 1>,
46
- # @stderr="stderr",
47
- # @stdout="stdout">
48
- #
49
- # @return [Git::CommandLineResult]
50
- #
51
- attr_reader :result
52
- end
53
- end
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Git
4
- # This error is raised when a git command fails
5
- #
6
- class GitExecuteError < StandardError; end
7
- end
@@ -1,50 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'git/git_execute_error'
4
-
5
- module Git
6
- # This error is raised when a git command exits because of an uncaught signal
7
- #
8
- # The git command executed, status, stdout, and stderr are available from this
9
- # object. The #message includes the git command, the status of the process, and
10
- # the stderr of the process.
11
- #
12
- # @api public
13
- #
14
- class SignaledError < Git::GitExecuteError
15
- # Create a SignaledError object
16
- #
17
- # @example
18
- # `kill -9 $$` # set $? appropriately for this example
19
- # result = Git::CommandLineResult.new(%w[git status], $?, '', "killed")
20
- # error = Git::SignaledError.new(result)
21
- # error.message #=>
22
- # "[\"git\", \"status\"]\nstatus: pid 88811 SIGKILL (signal 9)\nstderr: \"killed\""
23
- #
24
- # @param result [Git::CommandLineResult] the result of the git command including the git command, status, stdout, and stderr
25
- #
26
- def initialize(result)
27
- super("#{result.git_cmd}\nstatus: #{result.status}\nstderr: #{result.stderr.inspect}")
28
- @result = result
29
- end
30
-
31
- # @attribute [r] result
32
- #
33
- # The result of the git command including the git command, status, and output
34
- #
35
- # @example
36
- # `kill -9 $$` # set $? appropriately for this example
37
- # result = Git::CommandLineResult.new(%w[git status], $?, '', "killed")
38
- # error = Git::SignaledError.new(result)
39
- # error.result #=>
40
- # #<Git::CommandLineResult:0x000000010470f6e8
41
- # @git_cmd=["git", "status"],
42
- # @status=#<Process::Status: pid 88811 SIGKILL (signal 9)>,
43
- # @stderr="killed",
44
- # @stdout="">
45
- #
46
- # @return [Git::CommandLineResult]
47
- #
48
- attr_reader :result
49
- end
50
- end
File without changes