git 2.0.0.pre3 → 2.0.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.
- checksums.yaml +4 -4
- data/.github/pull_request_template.md +8 -0
- data/.github/workflows/continuous_integration.yml +0 -10
- data/.github/workflows/experimental_continuous_integration.yml +43 -0
- data/CHANGELOG.md +38 -0
- data/CONTRIBUTING.md +22 -67
- data/README.md +64 -75
- data/git.gemspec +2 -0
- data/lib/git/base.rb +90 -3
- data/lib/git/command_line.rb +21 -12
- data/lib/git/errors.rb +206 -0
- data/lib/git/lib.rb +56 -18
- data/lib/git/object.rb +69 -67
- data/lib/git/status.rb +86 -16
- data/lib/git/version.rb +1 -1
- data/lib/git.rb +7 -10
- metadata +37 -16
- data/.github/stale.yml +0 -25
- data/Dockerfile.changelog-rs +0 -12
- data/PULL_REQUEST_TEMPLATE.md +0 -9
- data/lib/git/base/factory.rb +0 -99
- data/lib/git/command_line_error.rb +0 -59
- data/lib/git/error.rb +0 -7
- data/lib/git/failed_error.rb +0 -14
- data/lib/git/git_execute_error.rb +0 -14
- data/lib/git/signaled_error.rb +0 -14
- data/lib/git/timeout_error.rb +0 -60
- /data/{ISSUE_TEMPLATE.md → .github/issue_template.md} +0 -0
data/Dockerfile.changelog-rs
DELETED
@@ -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"]
|
data/PULL_REQUEST_TEMPLATE.md
DELETED
@@ -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/lib/git/base/factory.rb
DELETED
@@ -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,59 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'error'
|
4
|
-
|
5
|
-
module Git
|
6
|
-
# Raised when a git command fails or exits because of an uncaught signal
|
7
|
-
#
|
8
|
-
# The git command executed, status, stdout, and stderr are available from this
|
9
|
-
# object.
|
10
|
-
#
|
11
|
-
# Rather than creating a CommandLineError object directly, it is recommended to use
|
12
|
-
# one of the derived classes for the appropriate type of error:
|
13
|
-
#
|
14
|
-
# * {Git::FailedError}: when the git command exits with a non-zero status
|
15
|
-
# * {Git::SignaledError}: when the git command exits because of an uncaught signal
|
16
|
-
# * {Git::TimeoutError}: when the git command times out
|
17
|
-
#
|
18
|
-
# @api public
|
19
|
-
#
|
20
|
-
class CommandLineError < Git::Error
|
21
|
-
# Create a CommandLineError object
|
22
|
-
#
|
23
|
-
# @example
|
24
|
-
# `exit 1` # set $? appropriately for this example
|
25
|
-
# result = Git::CommandLineResult.new(%w[git status], $?, 'stdout', 'stderr')
|
26
|
-
# error = Git::CommandLineError.new(result)
|
27
|
-
# error.to_s #=> '["git", "status"], status: pid 89784 exit 1, stderr: "stderr"'
|
28
|
-
#
|
29
|
-
# @param result [Git::CommandLineResult] the result of the git command including
|
30
|
-
# the git command, status, stdout, and stderr
|
31
|
-
#
|
32
|
-
def initialize(result)
|
33
|
-
@result = result
|
34
|
-
super()
|
35
|
-
end
|
36
|
-
|
37
|
-
# The human readable representation of this error
|
38
|
-
#
|
39
|
-
# @example
|
40
|
-
# error.to_s #=> '["git", "status"], status: pid 89784 exit 1, stderr: "stderr"'
|
41
|
-
#
|
42
|
-
# @return [String]
|
43
|
-
#
|
44
|
-
def to_s = <<~MESSAGE.chomp
|
45
|
-
#{result.git_cmd}, status: #{result.status}, stderr: #{result.stderr.inspect}
|
46
|
-
MESSAGE
|
47
|
-
|
48
|
-
# @attribute [r] result
|
49
|
-
#
|
50
|
-
# The result of the git command including the git command and its status and output
|
51
|
-
#
|
52
|
-
# @example
|
53
|
-
# error.result #=> #<Git::CommandLineResult:0x00000001046bd488 ...>
|
54
|
-
#
|
55
|
-
# @return [Git::CommandLineResult]
|
56
|
-
#
|
57
|
-
attr_reader :result
|
58
|
-
end
|
59
|
-
end
|
data/lib/git/error.rb
DELETED
data/lib/git/failed_error.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'command_line_error'
|
4
|
-
|
5
|
-
module Git
|
6
|
-
# This error is raised when a git command returns a non-zero exitstatus
|
7
|
-
#
|
8
|
-
# The git command executed, status, stdout, and stderr are available from this
|
9
|
-
# object.
|
10
|
-
#
|
11
|
-
# @api public
|
12
|
-
#
|
13
|
-
class FailedError < Git::CommandLineError; end
|
14
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'error'
|
4
|
-
|
5
|
-
module Git
|
6
|
-
# This error is raised when a git command fails
|
7
|
-
#
|
8
|
-
# This error class is used as an alias for Git::Error for backwards compatibility.
|
9
|
-
# It is recommended to use Git::Error directly.
|
10
|
-
#
|
11
|
-
# @deprecated Use Git::Error instead
|
12
|
-
#
|
13
|
-
GitExecuteError = Git::Error
|
14
|
-
end
|
data/lib/git/signaled_error.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'command_line_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.
|
10
|
-
#
|
11
|
-
# @api public
|
12
|
-
#
|
13
|
-
class SignaledError < Git::CommandLineError; end
|
14
|
-
end
|
data/lib/git/timeout_error.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative 'signaled_error'
|
4
|
-
|
5
|
-
module Git
|
6
|
-
# This error is raised when a git command takes longer than the configured timeout
|
7
|
-
#
|
8
|
-
# The git command executed, status, stdout, and stderr, and the timeout duration
|
9
|
-
# are available from this object.
|
10
|
-
#
|
11
|
-
# result.status.timeout? will be `true`
|
12
|
-
#
|
13
|
-
# @api public
|
14
|
-
#
|
15
|
-
class TimeoutError < Git::SignaledError
|
16
|
-
# Create a TimeoutError object
|
17
|
-
#
|
18
|
-
# @example
|
19
|
-
# command = %w[sleep 10]
|
20
|
-
# timeout_duration = 1
|
21
|
-
# status = ProcessExecuter.spawn(*command, timeout: timeout_duration)
|
22
|
-
# result = Git::CommandLineResult.new(command, status, 'stdout', 'err output')
|
23
|
-
# error = Git::TimeoutError.new(result, timeout_duration)
|
24
|
-
# error.to_s #=> '["sleep", "10"], status: pid 70144 SIGKILL (signal 9), stderr: "err output", timed out after 1s'
|
25
|
-
#
|
26
|
-
# @param result [Git::CommandLineResult] the result of the git command including
|
27
|
-
# the git command, status, stdout, and stderr
|
28
|
-
#
|
29
|
-
# @param timeout_duration [Numeric] the amount of time the subprocess was allowed
|
30
|
-
# to run before being killed
|
31
|
-
#
|
32
|
-
def initialize(result, timeout_duration)
|
33
|
-
@timeout_duration = timeout_duration
|
34
|
-
super(result)
|
35
|
-
end
|
36
|
-
|
37
|
-
# The human readable representation of this error
|
38
|
-
#
|
39
|
-
# @example
|
40
|
-
# error.to_s #=> '["sleep", "10"], status: pid 88811 SIGKILL (signal 9), stderr: "err output", timed out after 1s'
|
41
|
-
#
|
42
|
-
# @return [String]
|
43
|
-
#
|
44
|
-
def to_s = <<~MESSAGE.chomp
|
45
|
-
#{super}, timed out after #{timeout_duration}s
|
46
|
-
MESSAGE
|
47
|
-
|
48
|
-
# The amount of time the subprocess was allowed to run before being killed
|
49
|
-
#
|
50
|
-
# @example
|
51
|
-
# `kill -9 $$` # set $? appropriately for this example
|
52
|
-
# result = Git::CommandLineResult.new(%w[git status], $?, '', "killed")
|
53
|
-
# error = Git::TimeoutError.new(result, 10)
|
54
|
-
# error.timeout_duration #=> 10
|
55
|
-
#
|
56
|
-
# @return [Numeric]
|
57
|
-
#
|
58
|
-
attr_reader :timeout_duration
|
59
|
-
end
|
60
|
-
end
|
File without changes
|