git 5.0.0.beta.2 → 5.0.0.beta.4
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/.dockerignore +27 -0
- data/.github/copilot-instructions.md +3 -8
- data/.github/hooks/bin-setup-on-worktree.json +11 -0
- data/.github/hooks/run-bin-setup-once.sh +14 -0
- data/.github/skills/breaking-change-analysis/SKILL.md +6 -9
- data/.github/skills/ci-cd-troubleshooting/SKILL.md +2 -2
- data/.github/skills/command-implementation/REFERENCE.md +34 -33
- data/.github/skills/command-implementation/SKILL.md +5 -4
- data/.github/skills/command-test-conventions/SKILL.md +13 -9
- data/.github/skills/command-yard-documentation/SKILL.md +14 -6
- data/.github/skills/development-workflow/SKILL.md +20 -14
- data/.github/skills/facade-implementation/REFERENCE.md +19 -22
- data/.github/skills/facade-implementation/SKILL.md +0 -5
- data/.github/skills/facade-test-conventions/SKILL.md +4 -7
- data/.github/skills/facade-yard-documentation/SKILL.md +8 -2
- data/.github/skills/make-skill-template/SKILL.md +53 -3
- data/.github/skills/pr-readiness-review/SKILL.md +22 -2
- data/.github/skills/project-context/SKILL.md +16 -23
- data/.github/skills/pull-request-review/SKILL.md +2 -2
- data/.github/skills/rebase/SKILL.md +148 -0
- data/.github/skills/refactor-command-to-commandlineresult/SKILL.md +1 -1
- data/.github/skills/resolve-feedback/SKILL.md +288 -0
- data/.github/skills/review-arguments-dsl/CHECKLIST.md +3 -3
- data/.github/skills/reviewing-skills/SKILL.md +28 -3
- data/.github/skills/test-debugging/SKILL.md +20 -19
- data/.github/skills/yard-documentation/SKILL.md +671 -483
- data/.github/skills/yard-documentation/element-rules.md +162 -0
- data/.github/skills-deprecated/README.md +21 -0
- data/.github/{skills → skills-deprecated}/extract-command-from-lib/SKILL.md +9 -9
- data/.github/{skills → skills-deprecated}/extract-facade-from-base-lib/SKILL.md +12 -12
- data/.github/workflows/continuous_integration.yml +3 -2
- data/.rubocop.yml +7 -39
- data/.yard-lint.yml +75 -0
- data/CONTRIBUTING.md +186 -174
- data/Gemfile +17 -0
- data/README.md +86 -23
- data/Rakefile +3 -21
- data/UPGRADING.md +219 -70
- data/docker/test/Dockerfile +32 -0
- data/docker/test/docker-compose.yml +0 -0
- data/git.gemspec +3 -4
- data/lib/git/author.rb +20 -1
- data/lib/git/branch.rb +26 -6
- data/lib/git/branch_delete_failure.rb +3 -0
- data/lib/git/branch_delete_result.rb +6 -3
- data/lib/git/branch_info.rb +6 -6
- data/lib/git/command_line/base.rb +6 -13
- data/lib/git/command_line/capturing.rb +67 -10
- data/lib/git/command_line/result.rb +0 -8
- data/lib/git/command_line/streaming.rb +45 -5
- data/lib/git/command_line.rb +4 -3
- data/lib/git/commands/add.rb +61 -53
- data/lib/git/commands/am/abort.rb +2 -2
- data/lib/git/commands/am/apply.rb +109 -98
- data/lib/git/commands/am/continue.rb +2 -2
- data/lib/git/commands/am/quit.rb +2 -2
- data/lib/git/commands/am/retry.rb +4 -2
- data/lib/git/commands/am/show_current_patch.rb +1 -1
- data/lib/git/commands/am/skip.rb +2 -2
- data/lib/git/commands/am.rb +2 -2
- data/lib/git/commands/apply.rb +7 -2
- data/lib/git/commands/archive/list_formats.rb +3 -3
- data/lib/git/commands/archive.rb +7 -2
- data/lib/git/commands/arguments.rb +1370 -359
- data/lib/git/commands/base.rb +111 -13
- data/lib/git/commands/branch/copy.rb +29 -21
- data/lib/git/commands/branch/create.rb +72 -68
- data/lib/git/commands/branch/delete.rb +25 -17
- data/lib/git/commands/branch/list.rb +76 -60
- data/lib/git/commands/branch/move.rb +29 -21
- data/lib/git/commands/branch/set_upstream.rb +8 -8
- data/lib/git/commands/branch/show_current.rb +3 -3
- data/lib/git/commands/branch/unset_upstream.rb +4 -8
- data/lib/git/commands/branch.rb +2 -2
- data/lib/git/commands/cat_file/batch.rb +36 -20
- data/lib/git/commands/cat_file/filtered.rb +12 -12
- data/lib/git/commands/cat_file/raw.rb +13 -13
- data/lib/git/commands/cat_file.rb +4 -4
- data/lib/git/commands/checkout/branch.rb +7 -5
- data/lib/git/commands/checkout/files.rb +5 -4
- data/lib/git/commands/checkout.rb +4 -4
- data/lib/git/commands/checkout_index.rb +5 -4
- data/lib/git/commands/clean.rb +6 -4
- data/lib/git/commands/clone.rb +5 -4
- data/lib/git/commands/commit.rb +5 -4
- data/lib/git/commands/commit_tree.rb +5 -4
- data/lib/git/commands/config_option_syntax/add.rb +7 -4
- data/lib/git/commands/config_option_syntax/get.rb +9 -5
- data/lib/git/commands/config_option_syntax/get_all.rb +7 -4
- data/lib/git/commands/config_option_syntax/get_color.rb +8 -4
- data/lib/git/commands/config_option_syntax/get_color_bool.rb +7 -4
- data/lib/git/commands/config_option_syntax/get_regexp.rb +8 -4
- data/lib/git/commands/config_option_syntax/get_urlmatch.rb +8 -4
- data/lib/git/commands/config_option_syntax/list.rb +8 -4
- data/lib/git/commands/config_option_syntax/remove_section.rb +7 -2
- data/lib/git/commands/config_option_syntax/rename_section.rb +7 -2
- data/lib/git/commands/config_option_syntax/replace_all.rb +7 -2
- data/lib/git/commands/config_option_syntax/set.rb +7 -2
- data/lib/git/commands/config_option_syntax/unset.rb +7 -4
- data/lib/git/commands/config_option_syntax/unset_all.rb +7 -2
- data/lib/git/commands/describe.rb +5 -4
- data/lib/git/commands/diff.rb +13 -12
- data/lib/git/commands/diff_files.rb +7 -6
- data/lib/git/commands/diff_index.rb +10 -7
- data/lib/git/commands/fetch.rb +6 -4
- data/lib/git/commands/fsck.rb +6 -4
- data/lib/git/commands/gc.rb +6 -4
- data/lib/git/commands/grep.rb +6 -5
- data/lib/git/commands/init.rb +6 -4
- data/lib/git/commands/log.rb +287 -285
- data/lib/git/commands/ls_files.rb +69 -65
- data/lib/git/commands/ls_remote.rb +62 -56
- data/lib/git/commands/ls_tree.rb +50 -46
- data/lib/git/commands/maintenance/register.rb +25 -23
- data/lib/git/commands/maintenance/run.rb +7 -2
- data/lib/git/commands/maintenance/start.rb +7 -2
- data/lib/git/commands/maintenance/stop.rb +7 -2
- data/lib/git/commands/maintenance/unregister.rb +7 -2
- data/lib/git/commands/merge/abort.rb +2 -2
- data/lib/git/commands/merge/continue.rb +2 -2
- data/lib/git/commands/merge/quit.rb +2 -2
- data/lib/git/commands/merge/start.rb +7 -2
- data/lib/git/commands/merge.rb +2 -2
- data/lib/git/commands/merge_base.rb +7 -2
- data/lib/git/commands/mv.rb +7 -2
- data/lib/git/commands/name_rev.rb +7 -2
- data/lib/git/commands/pull.rb +7 -2
- data/lib/git/commands/push.rb +7 -2
- data/lib/git/commands/read_tree.rb +7 -2
- data/lib/git/commands/remote/add.rb +7 -2
- data/lib/git/commands/remote/get_url.rb +4 -2
- data/lib/git/commands/remote/list.rb +4 -2
- data/lib/git/commands/remote/prune.rb +4 -2
- data/lib/git/commands/remote/remove.rb +4 -2
- data/lib/git/commands/remote/rename.rb +4 -2
- data/lib/git/commands/remote/set_branches.rb +9 -2
- data/lib/git/commands/remote/set_head.rb +12 -5
- data/lib/git/commands/remote/set_url.rb +9 -2
- data/lib/git/commands/remote/set_url_add.rb +11 -2
- data/lib/git/commands/remote/set_url_delete.rb +9 -2
- data/lib/git/commands/remote/show.rb +18 -12
- data/lib/git/commands/remote/update.rb +19 -12
- data/lib/git/commands/remote.rb +2 -2
- data/lib/git/commands/repack.rb +67 -63
- data/lib/git/commands/reset.rb +51 -44
- data/lib/git/commands/rev_parse.rb +135 -128
- data/lib/git/commands/revert/abort.rb +2 -2
- data/lib/git/commands/revert/continue.rb +7 -2
- data/lib/git/commands/revert/quit.rb +2 -2
- data/lib/git/commands/revert/skip.rb +2 -2
- data/lib/git/commands/revert/start.rb +7 -2
- data/lib/git/commands/revert.rb +2 -2
- data/lib/git/commands/rm.rb +35 -36
- data/lib/git/commands/show.rb +1 -1
- data/lib/git/commands/show_ref/exclude_existing.rb +3 -4
- data/lib/git/commands/show_ref/exists.rb +15 -13
- data/lib/git/commands/show_ref/list.rb +39 -35
- data/lib/git/commands/show_ref/verify.rb +29 -27
- data/lib/git/commands/show_ref.rb +4 -4
- data/lib/git/commands/stash/apply.rb +31 -25
- data/lib/git/commands/stash/branch.rb +10 -8
- data/lib/git/commands/stash/clear.rb +7 -5
- data/lib/git/commands/stash/create.rb +10 -8
- data/lib/git/commands/stash/drop.rb +15 -9
- data/lib/git/commands/stash/list.rb +9 -5
- data/lib/git/commands/stash/pop.rb +21 -12
- data/lib/git/commands/stash/push.rb +20 -11
- data/lib/git/commands/stash/show.rb +21 -12
- data/lib/git/commands/stash/store.rb +19 -10
- data/lib/git/commands/stash.rb +2 -2
- data/lib/git/commands/status.rb +7 -2
- data/lib/git/commands/symbolic_ref/delete.rb +18 -14
- data/lib/git/commands/symbolic_ref/read.rb +24 -20
- data/lib/git/commands/symbolic_ref/update.rb +20 -17
- data/lib/git/commands/symbolic_ref.rb +4 -4
- data/lib/git/commands/tag/create.rb +45 -42
- data/lib/git/commands/tag/delete.rb +5 -3
- data/lib/git/commands/tag/list.rb +47 -44
- data/lib/git/commands/tag/verify.rb +12 -12
- data/lib/git/commands/tag.rb +2 -2
- data/lib/git/commands/update_ref/batch.rb +6 -1
- data/lib/git/commands/update_ref/delete.rb +19 -21
- data/lib/git/commands/update_ref/update.rb +22 -25
- data/lib/git/commands/update_ref.rb +4 -4
- data/lib/git/commands/version.rb +14 -11
- data/lib/git/commands/worktree/add.rb +50 -51
- data/lib/git/commands/worktree/list.rb +17 -17
- data/lib/git/commands/worktree/lock.rb +12 -12
- data/lib/git/commands/worktree/move.rb +16 -16
- data/lib/git/commands/worktree/prune.rb +2 -2
- data/lib/git/commands/worktree/remove.rb +2 -2
- data/lib/git/commands/worktree/repair.rb +2 -2
- data/lib/git/commands/worktree/unlock.rb +2 -2
- data/lib/git/commands/write_tree.rb +2 -2
- data/lib/git/commands.rb +4 -3
- data/lib/git/config.rb +47 -1
- data/lib/git/configuring.rb +89 -15
- data/lib/git/detached_head_info.rb +4 -1
- data/lib/git/diff.rb +2 -5
- data/lib/git/diff_file_numstat_info.rb +3 -1
- data/lib/git/diff_file_patch_info.rb +3 -1
- data/lib/git/diff_file_raw_info.rb +3 -1
- data/lib/git/diff_info.rb +8 -15
- data/lib/git/diff_path_status.rb +16 -3
- data/lib/git/diff_result.rb +3 -1
- data/lib/git/diff_stats.rb +15 -0
- data/lib/git/dirstat_info.rb +24 -8
- data/lib/git/encoding_utils.rb +32 -1
- data/lib/git/errors.rb +19 -9
- data/lib/git/escaped_path.rb +55 -3
- data/lib/git/execution_context/repository.rb +15 -0
- data/lib/git/execution_context.rb +76 -74
- data/lib/git/file_ref.rb +6 -3
- data/lib/git/fsck_object.rb +8 -0
- data/lib/git/fsck_result.rb +26 -15
- data/lib/git/log.rb +152 -5
- data/lib/git/object.rb +284 -8
- data/lib/git/parsers/branch.rb +18 -0
- data/lib/git/parsers/cat_file.rb +2 -2
- data/lib/git/parsers/diff.rb +213 -5
- data/lib/git/parsers/fsck.rb +11 -0
- data/lib/git/parsers/ls_remote.rb +1 -1
- data/lib/git/parsers/stash.rb +51 -0
- data/lib/git/parsers/tag.rb +38 -0
- data/lib/git/remote.rb +34 -2
- data/lib/git/repository/branching.rb +23 -21
- data/lib/git/repository/committing.rb +46 -6
- data/lib/git/repository/context_helpers.rb +45 -16
- data/lib/git/repository/diffing.rb +32 -23
- data/lib/git/repository/factories.rb +153 -28
- data/lib/git/repository/inspecting.rb +1 -1
- data/lib/git/repository/logging.rb +169 -30
- data/lib/git/repository/maintenance.rb +1 -1
- data/lib/git/repository/merging.rb +3 -3
- data/lib/git/repository/object_operations.rb +108 -14
- data/lib/git/repository/remote_operations.rb +150 -171
- data/lib/git/repository/shared_private.rb +7 -5
- data/lib/git/repository/staging.rb +36 -12
- data/lib/git/repository/stashing.rb +16 -16
- data/lib/git/repository/status_operations.rb +1 -1
- data/lib/git/repository/worktree_operations.rb +1 -1
- data/lib/git/repository.rb +287 -6
- data/lib/git/stash.rb +16 -21
- data/lib/git/stash_info.rb +4 -4
- data/lib/git/stashes.rb +20 -26
- data/lib/git/status.rb +25 -13
- data/lib/git/tag_delete_failure.rb +3 -0
- data/lib/git/tag_delete_result.rb +6 -3
- data/lib/git/tag_info.rb +1 -0
- data/lib/git/url.rb +12 -5
- data/lib/git/version.rb +6 -4
- data/lib/git/version_constraint.rb +4 -0
- data/lib/git.rb +400 -314
- data/redesign/3_architecture_implementation.md +81 -30
- data/redesign/Phase 4 - Step A.md +6 -0
- data/redesign/Phase 4 - Step B.md +921 -0
- data/redesign/Phase 4 - Step C.md +833 -0
- data/redesign/c1a-public-api-scope.tsv +256 -0
- data/redesign/phase-4-step-b-test-audit.tsv +485 -0
- data/tasks/yard.rake +24 -17
- metadata +24 -58
- data/commitlint.test +0 -4
- data/lib/git/args_builder.rb +0 -103
- data/lib/git/command_line_result.rb +0 -8
- data/lib/git/deprecation.rb +0 -9
- data/lib/git/repository/configuring.rb +0 -351
- data/tasks/test.rake +0 -25
- /data/.github/{skills → skills-deprecated}/extract-facade-from-base-lib/KEYWORD_ARG_REMEDIATION.md +0 -0
- /data/.github/{skills → skills-deprecated}/review-backward-compatibility/SKILL.md +0 -0
data/lib/git/status.rb
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# These would be required by the main `git.rb` file
|
|
4
|
-
|
|
5
3
|
module Git
|
|
6
4
|
# The Status class gets the status of a git repository. It identifies which
|
|
7
5
|
# files have been modified, added, or deleted, including untracked files.
|
|
8
6
|
# The Status object is an Enumerable of StatusFile objects.
|
|
9
7
|
#
|
|
8
|
+
# @example Inspect repository status
|
|
9
|
+
# repo = Git.open('/path/to/repo')
|
|
10
|
+
# status = repo.status
|
|
11
|
+
# status.changed.each { |path, _file| puts "Modified: #{path}" }
|
|
12
|
+
# status.added.each { |path, _file| puts "Added: #{path}" }
|
|
13
|
+
# status.deleted.each { |path, _file| puts "Deleted: #{path}" }
|
|
14
|
+
# status.untracked.each { |path, _file| puts "Untracked: #{path}" }
|
|
15
|
+
#
|
|
10
16
|
# @api public
|
|
11
17
|
#
|
|
12
18
|
class Status
|
|
@@ -91,13 +97,19 @@ module Git
|
|
|
91
97
|
|
|
92
98
|
# Iterate over all status files
|
|
93
99
|
#
|
|
94
|
-
# @
|
|
100
|
+
# @overload each
|
|
95
101
|
#
|
|
96
|
-
#
|
|
102
|
+
# @return [Enumerator<Git::Status::StatusFile>] an enumerator over all status files
|
|
103
|
+
#
|
|
104
|
+
# @overload each(&block)
|
|
97
105
|
#
|
|
98
|
-
#
|
|
106
|
+
# @return [Array<Git::Status::StatusFile>] the full list of status files
|
|
99
107
|
#
|
|
100
|
-
#
|
|
108
|
+
# @yield [file] each {Git::Status::StatusFile} in the repository
|
|
109
|
+
#
|
|
110
|
+
# @yieldparam file [Git::Status::StatusFile] a single file's status
|
|
111
|
+
#
|
|
112
|
+
# @yieldreturn [void]
|
|
101
113
|
#
|
|
102
114
|
def each(&) = @files.values.each(&)
|
|
103
115
|
|
|
@@ -131,11 +143,13 @@ module Git
|
|
|
131
143
|
|
|
132
144
|
# Return a hash of files for which the block returns a truthy value
|
|
133
145
|
#
|
|
146
|
+
# @return [Hash{String => Git::Status::StatusFile}] matching files keyed by path
|
|
147
|
+
#
|
|
134
148
|
# @yield [file] each {Git::Status::StatusFile} in the repository
|
|
135
149
|
#
|
|
136
150
|
# @yieldparam file [Git::Status::StatusFile] a single file's status
|
|
137
151
|
#
|
|
138
|
-
# @
|
|
152
|
+
# @yieldreturn [Boolean] truthy to include the file in the result
|
|
139
153
|
#
|
|
140
154
|
def select_files(&block)
|
|
141
155
|
@files.select { |_path, file| block.call(file) }
|
|
@@ -172,17 +186,15 @@ module Git
|
|
|
172
186
|
|
|
173
187
|
# Return `true` when git is configured to ignore filename case
|
|
174
188
|
#
|
|
175
|
-
# Reads `core.ignoreCase`
|
|
176
|
-
# the config value is absent
|
|
189
|
+
# Reads `core.ignoreCase` with {Git::Repository#config_get}. Returns `false`
|
|
190
|
+
# when the config value is absent.
|
|
177
191
|
#
|
|
178
192
|
# @return [Boolean] `true` when `core.ignoreCase` is `"true"`
|
|
179
193
|
#
|
|
180
194
|
def ignore_case?
|
|
181
|
-
return @
|
|
195
|
+
return @ignore_case if defined?(@ignore_case)
|
|
182
196
|
|
|
183
|
-
@
|
|
184
|
-
rescue Git::FailedError
|
|
185
|
-
@_ignore_case = false
|
|
197
|
+
@ignore_case = (@base.config_get('core.ignoreCase')&.value == 'true')
|
|
186
198
|
end
|
|
187
199
|
end
|
|
188
200
|
end
|
|
@@ -15,16 +15,19 @@ module Git
|
|
|
15
15
|
# failure.error_message #=> "tag 'nonexistent' not found."
|
|
16
16
|
#
|
|
17
17
|
# @see Git::TagDeleteResult
|
|
18
|
+
#
|
|
18
19
|
# @see Git::Commands::Tag::Delete
|
|
19
20
|
#
|
|
20
21
|
# @api public
|
|
21
22
|
#
|
|
22
23
|
# @!attribute [r] name
|
|
23
24
|
# The name of the tag that failed to be deleted
|
|
25
|
+
#
|
|
24
26
|
# @return [String]
|
|
25
27
|
#
|
|
26
28
|
# @!attribute [r] error_message
|
|
27
29
|
# The error message from git explaining why the tag could not be deleted
|
|
30
|
+
#
|
|
28
31
|
# @return [String]
|
|
29
32
|
#
|
|
30
33
|
TagDeleteFailure = Data.define(:name, :error_message)
|
|
@@ -29,25 +29,27 @@ module Git
|
|
|
29
29
|
# result.not_deleted.first.error_message #=> "tag 'nonexistent' not found."
|
|
30
30
|
#
|
|
31
31
|
# @see Git::TagInfo
|
|
32
|
+
#
|
|
32
33
|
# @see Git::TagDeleteFailure
|
|
34
|
+
#
|
|
33
35
|
# @see Git::Commands::Tag::Delete
|
|
34
36
|
#
|
|
35
37
|
# @api public
|
|
36
38
|
#
|
|
37
39
|
# @!attribute [r] deleted
|
|
38
40
|
# Tags that were successfully deleted
|
|
41
|
+
#
|
|
39
42
|
# @return [Array<Git::TagInfo>]
|
|
40
43
|
#
|
|
41
44
|
# @!attribute [r] not_deleted
|
|
42
45
|
# Tags that could not be deleted, with the reason for each failure
|
|
46
|
+
#
|
|
43
47
|
# @return [Array<Git::TagDeleteFailure>]
|
|
44
48
|
#
|
|
45
49
|
TagDeleteResult = Data.define(:deleted, :not_deleted) do
|
|
46
50
|
# Returns true if all requested tags were successfully deleted
|
|
47
51
|
#
|
|
48
|
-
# @
|
|
49
|
-
#
|
|
50
|
-
# @example
|
|
52
|
+
# @example Check if the delete operation succeeded
|
|
51
53
|
# result = tag_delete.call('v1.0.0')
|
|
52
54
|
# if result.success?
|
|
53
55
|
# puts "All tags deleted successfully"
|
|
@@ -56,6 +58,7 @@ module Git
|
|
|
56
58
|
# result.not_deleted.each { |f| puts " #{f.name}: #{f.error_message}" }
|
|
57
59
|
# end
|
|
58
60
|
#
|
|
61
|
+
# @return [Boolean] true if no tags failed to delete, false otherwise
|
|
59
62
|
def success?
|
|
60
63
|
not_deleted.empty?
|
|
61
64
|
end
|
data/lib/git/tag_info.rb
CHANGED
data/lib/git/url.rb
CHANGED
|
@@ -8,9 +8,10 @@ module Git
|
|
|
8
8
|
# Any URL that can be passed to `git clone` can be parsed by this class.
|
|
9
9
|
#
|
|
10
10
|
# @see https://git-scm.com/docs/git-clone#_git_urls GIT URLs
|
|
11
|
-
# @see https://github.com/sporkmonger/addressable Addresable::URI
|
|
12
11
|
#
|
|
13
|
-
# @
|
|
12
|
+
# @see https://github.com/sporkmonger/addressable Addressable::URI
|
|
13
|
+
#
|
|
14
|
+
# @api private
|
|
14
15
|
#
|
|
15
16
|
class URL
|
|
16
17
|
# Regexp used to match a Git URL with an alternative SSH syntax
|
|
@@ -30,7 +31,7 @@ module Git
|
|
|
30
31
|
# The URI returned can be converted back to a string with 'to_s'. This is
|
|
31
32
|
# guaranteed to return the same URL string that was parsed.
|
|
32
33
|
#
|
|
33
|
-
# @example
|
|
34
|
+
# @example Parsing clone target from HTTPS and local paths
|
|
34
35
|
# uri = Git::URL.parse('https://github.com/ruby-git/ruby-git.git')
|
|
35
36
|
# #=> #<Addressable::URI:0x44c URI:https://github.com/ruby-git/ruby-git.git>
|
|
36
37
|
# uri.scheme #=> "https"
|
|
@@ -54,11 +55,15 @@ module Git
|
|
|
54
55
|
|
|
55
56
|
# The directory `git clone` would use for the repository directory for the given URL
|
|
56
57
|
#
|
|
57
|
-
# @example
|
|
58
|
+
# @example Deriving the clone directory name
|
|
58
59
|
# Git::URL.clone_to('https://github.com/ruby-git/ruby-git.git') #=> 'ruby-git'
|
|
59
60
|
#
|
|
60
61
|
# @param url [String] the Git URL containing the repository directory
|
|
61
62
|
#
|
|
63
|
+
# @param bare [Boolean] whether the repository should be cloned as bare
|
|
64
|
+
#
|
|
65
|
+
# @param mirror [Boolean] whether the repository should be cloned as a mirror
|
|
66
|
+
#
|
|
62
67
|
# @return [String] the name of the repository directory
|
|
63
68
|
#
|
|
64
69
|
def self.clone_to(url, bare: false, mirror: false)
|
|
@@ -80,7 +85,7 @@ module Git
|
|
|
80
85
|
# This class is necessary to ensure that #to_s returns the same string
|
|
81
86
|
# that was passed to the initializer.
|
|
82
87
|
#
|
|
83
|
-
# @api
|
|
88
|
+
# @api private
|
|
84
89
|
#
|
|
85
90
|
class GitAltURI < Addressable::URI
|
|
86
91
|
# Create a new GitAltURI object
|
|
@@ -90,7 +95,9 @@ module Git
|
|
|
90
95
|
# uri.to_s #=> 'james@github.com/james/ruby-git'
|
|
91
96
|
#
|
|
92
97
|
# @param user [String, nil] the user from the URL or nil
|
|
98
|
+
#
|
|
93
99
|
# @param host [String] the host from the URL
|
|
100
|
+
#
|
|
94
101
|
# @param path [String] the path from the URL
|
|
95
102
|
#
|
|
96
103
|
def initialize(user:, host:, path:)
|
data/lib/git/version.rb
CHANGED
|
@@ -4,7 +4,7 @@ module Git
|
|
|
4
4
|
# The current gem version
|
|
5
5
|
#
|
|
6
6
|
# @return [String] the current gem version
|
|
7
|
-
VERSION = '5.0.0.beta.
|
|
7
|
+
VERSION = '5.0.0.beta.4'
|
|
8
8
|
|
|
9
9
|
# Represents a git version with major, minor, and patch components
|
|
10
10
|
#
|
|
@@ -14,14 +14,17 @@ module Git
|
|
|
14
14
|
#
|
|
15
15
|
# @!attribute [r] major
|
|
16
16
|
# The major version number
|
|
17
|
+
#
|
|
17
18
|
# @return [Integer]
|
|
18
19
|
#
|
|
19
20
|
# @!attribute [r] minor
|
|
20
21
|
# The minor version number
|
|
22
|
+
#
|
|
21
23
|
# @return [Integer]
|
|
22
24
|
#
|
|
23
25
|
# @!attribute [r] patch
|
|
24
26
|
# The patch version number
|
|
27
|
+
#
|
|
25
28
|
# @return [Integer]
|
|
26
29
|
#
|
|
27
30
|
# @example Creating a version directly
|
|
@@ -102,11 +105,10 @@ module Git
|
|
|
102
105
|
# Useful when legacy code expects the array shape returned by the
|
|
103
106
|
# deprecated `Git::Lib#current_command_version` method.
|
|
104
107
|
#
|
|
105
|
-
# @
|
|
106
|
-
#
|
|
107
|
-
# @example
|
|
108
|
+
# @example Get version as integer components
|
|
108
109
|
# Git.git_version.to_a #=> [2, 42, 0]
|
|
109
110
|
#
|
|
111
|
+
# @return [Array<Integer>] [major, minor, patch]
|
|
110
112
|
def to_a
|
|
111
113
|
deconstruct
|
|
112
114
|
end
|
|
@@ -26,8 +26,12 @@ module Git
|
|
|
26
26
|
# @api public
|
|
27
27
|
#
|
|
28
28
|
VersionConstraint = Data.define(:min, :before) do
|
|
29
|
+
# Initialize a new VersionConstraint
|
|
30
|
+
#
|
|
29
31
|
# @param min [Git::Version, nil] minimum version (inclusive)
|
|
32
|
+
#
|
|
30
33
|
# @param before [Git::Version, nil] upper bound version (exclusive)
|
|
34
|
+
#
|
|
31
35
|
def initialize(min: nil, before: nil)
|
|
32
36
|
super
|
|
33
37
|
end
|