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
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'git/commands/base'
|
|
4
|
-
require 'git/commands/show_ref'
|
|
5
4
|
|
|
6
5
|
module Git
|
|
7
6
|
module Commands
|
|
@@ -51,27 +50,30 @@ module Git
|
|
|
51
50
|
# All three are valid results — callers check exitstatus to distinguish them.
|
|
52
51
|
allow_exit_status 0..2
|
|
53
52
|
|
|
54
|
-
#
|
|
53
|
+
# @overload call(ref, **options)
|
|
55
54
|
#
|
|
56
|
-
#
|
|
55
|
+
# Execute `git show-ref --exists` to check whether a ref exists
|
|
57
56
|
#
|
|
58
|
-
#
|
|
57
|
+
# @param ref [String] the fully-qualified ref name to check
|
|
58
|
+
# (e.g. `"refs/heads/main"`)
|
|
59
59
|
#
|
|
60
|
-
#
|
|
61
|
-
# (e.g. `"refs/heads/main"`)
|
|
60
|
+
# @param options [Hash] command options
|
|
62
61
|
#
|
|
63
|
-
#
|
|
62
|
+
# @option options [Numeric] :timeout (nil) abort the command after this many
|
|
63
|
+
# seconds
|
|
64
64
|
#
|
|
65
|
-
#
|
|
66
|
-
#
|
|
65
|
+
# @return [Git::CommandLine::Result] the result of calling
|
|
66
|
+
# `git show-ref --exists`
|
|
67
67
|
#
|
|
68
|
-
#
|
|
69
|
-
# `git show-ref --exists`
|
|
68
|
+
# @raise [ArgumentError] if unsupported options are provided
|
|
70
69
|
#
|
|
71
|
-
#
|
|
70
|
+
# @raise [Git::FailedError] if git exits outside the allowed range (exit code > 2)
|
|
72
71
|
#
|
|
73
|
-
#
|
|
72
|
+
# @api public
|
|
74
73
|
#
|
|
74
|
+
def call(*, **)
|
|
75
|
+
super
|
|
76
|
+
end
|
|
75
77
|
end
|
|
76
78
|
end
|
|
77
79
|
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'git/commands/base'
|
|
4
|
-
require 'git/commands/show_ref'
|
|
5
4
|
|
|
6
5
|
module Git
|
|
7
6
|
module Commands
|
|
@@ -19,8 +18,6 @@ module Git
|
|
|
19
18
|
# For stdin-based filtering, use {Git::Commands::ShowRef::ExcludeExisting}.
|
|
20
19
|
# For a simple boolean existence check (git >= 2.43), use {Git::Commands::ShowRef::Exists}.
|
|
21
20
|
#
|
|
22
|
-
# @note `arguments` block audited against https://git-scm.com/docs/git-show-ref/2.53.0
|
|
23
|
-
#
|
|
24
21
|
# @example List all refs
|
|
25
22
|
# cmd = Git::Commands::ShowRef::List.new(execution_context)
|
|
26
23
|
# result = cmd.call
|
|
@@ -38,6 +35,8 @@ module Git
|
|
|
38
35
|
# cmd = Git::Commands::ShowRef::List.new(execution_context)
|
|
39
36
|
# result = cmd.call('v1.0', 'v2.0', tags: true)
|
|
40
37
|
#
|
|
38
|
+
# @note `arguments` block audited against https://git-scm.com/docs/git-show-ref/2.53.0
|
|
39
|
+
#
|
|
41
40
|
# @see Git::Commands::ShowRef
|
|
42
41
|
#
|
|
43
42
|
# @see https://git-scm.com/docs/git-show-ref
|
|
@@ -49,34 +48,34 @@ module Git
|
|
|
49
48
|
literal 'show-ref'
|
|
50
49
|
|
|
51
50
|
# Include the HEAD ref even if it would normally be filtered out
|
|
52
|
-
#
|
|
51
|
+
# See https://git-scm.com/docs/git-show-ref#Documentation/git-show-ref.txt---head
|
|
53
52
|
flag_option :head
|
|
54
53
|
|
|
55
54
|
# Dereference annotated tags; outputs an additional line per tag with
|
|
56
55
|
# the de-referenced object SHA followed by `^{}`
|
|
57
|
-
#
|
|
56
|
+
# See https://git-scm.com/docs/git-show-ref#Documentation/git-show-ref.txt---dereference
|
|
58
57
|
flag_option %i[dereference d]
|
|
59
58
|
|
|
60
59
|
# Show only the SHA part of the ref, optionally abbreviated to <n> hex digits;
|
|
61
60
|
# pass `true` for full-length SHA, or an integer for the abbreviation length
|
|
62
|
-
#
|
|
61
|
+
# See https://git-scm.com/docs/git-show-ref#Documentation/git-show-ref.txt---hashn
|
|
63
62
|
flag_or_value_option %i[hash s], inline: true
|
|
64
63
|
|
|
65
64
|
# Abbreviate the object names to at least <n> hex digits; pass `true` to
|
|
66
65
|
# use the default abbreviation length, or an integer for an explicit length
|
|
67
|
-
#
|
|
66
|
+
# See https://git-scm.com/docs/git-show-ref#Documentation/git-show-ref.txt---abbrevlength
|
|
68
67
|
flag_or_value_option :abbrev, inline: true
|
|
69
68
|
|
|
70
69
|
# Limit to refs under refs/heads/ only (preferred over :heads on git >= 2.46)
|
|
71
|
-
#
|
|
70
|
+
# See https://git-scm.com/docs/git-show-ref#Documentation/git-show-ref.txt---branches
|
|
72
71
|
flag_option :branches
|
|
73
72
|
|
|
74
73
|
# Limit to refs under refs/heads/ only (deprecated synonym for :branches in git >= 2.46)
|
|
75
|
-
#
|
|
74
|
+
# See https://git-scm.com/docs/git-show-ref#Documentation/git-show-ref.txt---branches
|
|
76
75
|
flag_option :heads
|
|
77
76
|
|
|
78
77
|
# Limit to refs under refs/tags/ only
|
|
79
|
-
#
|
|
78
|
+
# See https://git-scm.com/docs/git-show-ref#Documentation/git-show-ref.txt---tags
|
|
80
79
|
flag_option :tags
|
|
81
80
|
|
|
82
81
|
execution_option :timeout
|
|
@@ -92,53 +91,58 @@ module Git
|
|
|
92
91
|
# Exit status 1 means no refs matched; that is a normal (non-error) outcome
|
|
93
92
|
allow_exit_status 0..1
|
|
94
93
|
|
|
95
|
-
#
|
|
94
|
+
# @overload call(*pattern, **options)
|
|
95
|
+
#
|
|
96
|
+
# Execute `git show-ref` to list matching refs
|
|
96
97
|
#
|
|
97
|
-
# @
|
|
98
|
+
# @param pattern [Array<String>] zero or more patterns to filter refs
|
|
98
99
|
#
|
|
99
|
-
#
|
|
100
|
+
# When empty, all refs are listed.
|
|
100
101
|
#
|
|
101
|
-
#
|
|
102
|
+
# @param options [Hash] command options
|
|
102
103
|
#
|
|
103
|
-
#
|
|
104
|
+
# @option options [Boolean, nil] :head (nil) show the HEAD ref even when filtered
|
|
104
105
|
#
|
|
105
|
-
#
|
|
106
|
+
# @option options [Boolean, nil] :dereference (nil) dereference annotated tags,
|
|
107
|
+
# emitting an extra line per tag whose SHA points to the tagged object
|
|
106
108
|
#
|
|
107
|
-
#
|
|
109
|
+
# Alias: `:d`
|
|
108
110
|
#
|
|
109
|
-
#
|
|
110
|
-
# emitting an extra line per tag whose SHA points to the tagged object
|
|
111
|
+
# @option options [Boolean, Integer, nil] :hash (nil) show only the SHA part of each ref
|
|
111
112
|
#
|
|
112
|
-
#
|
|
113
|
+
# Pass `true` for full-length SHAs or an integer for the abbreviation length
|
|
114
|
+
# (e.g. `hash: 7`).
|
|
113
115
|
#
|
|
114
|
-
#
|
|
116
|
+
# Alias: `:s`
|
|
115
117
|
#
|
|
116
|
-
#
|
|
117
|
-
# (e.g. `hash: 7`).
|
|
118
|
+
# @option options [Boolean, Integer, nil] :abbrev (nil) abbreviate object names
|
|
118
119
|
#
|
|
119
|
-
#
|
|
120
|
+
# Pass `true` for the default length or an integer for a specific length.
|
|
120
121
|
#
|
|
121
|
-
#
|
|
122
|
+
# @option options [Boolean, nil] :branches (nil) limit output to local branches (refs/heads/)
|
|
122
123
|
#
|
|
123
|
-
#
|
|
124
|
+
# Prefer `:branches` over `:heads` on git >= 2.46; `:heads` emits the deprecated
|
|
125
|
+
# `--heads` flag.
|
|
124
126
|
#
|
|
125
|
-
#
|
|
127
|
+
# @option options [Boolean, nil] :heads (nil) limit output to refs under refs/heads/
|
|
126
128
|
#
|
|
127
|
-
#
|
|
128
|
-
# `--heads` flag.
|
|
129
|
+
# Deprecated at the git level in git 2.46. Use `:branches` instead.
|
|
129
130
|
#
|
|
130
|
-
#
|
|
131
|
+
# @option options [Boolean, nil] :tags (nil) limit output to refs under refs/tags/
|
|
131
132
|
#
|
|
132
|
-
#
|
|
133
|
+
# @option options [Numeric] :timeout (nil) abort the command after this many seconds
|
|
133
134
|
#
|
|
134
|
-
#
|
|
135
|
+
# @return [Git::CommandLine::Result] the result of calling `git show-ref`
|
|
135
136
|
#
|
|
136
|
-
#
|
|
137
|
+
# @raise [ArgumentError] if unsupported options are provided
|
|
137
138
|
#
|
|
138
|
-
#
|
|
139
|
+
# @raise [Git::FailedError] if git exits outside the allowed range (exit code > 1)
|
|
139
140
|
#
|
|
140
|
-
#
|
|
141
|
+
# @api public
|
|
141
142
|
#
|
|
143
|
+
def call(*, **)
|
|
144
|
+
super
|
|
145
|
+
end
|
|
142
146
|
end
|
|
143
147
|
end
|
|
144
148
|
end
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'git/commands/base'
|
|
4
|
-
require 'git/commands/show_ref'
|
|
5
4
|
|
|
6
5
|
module Git
|
|
7
6
|
module Commands
|
|
@@ -49,19 +48,19 @@ module Git
|
|
|
49
48
|
literal '--verify'
|
|
50
49
|
|
|
51
50
|
# Suppress output; useful when you only care whether the ref exists
|
|
52
|
-
#
|
|
51
|
+
# See https://git-scm.com/docs/git-show-ref#Documentation/git-show-ref.txt---quiet
|
|
53
52
|
flag_option %i[quiet q]
|
|
54
53
|
|
|
55
54
|
# Dereference annotated tags; emit an extra line per tag with SHA^{}
|
|
56
|
-
#
|
|
55
|
+
# See https://git-scm.com/docs/git-show-ref#Documentation/git-show-ref.txt---dereference
|
|
57
56
|
flag_option %i[dereference d]
|
|
58
57
|
|
|
59
58
|
# Show only the SHA; pass `true` for full-length or an integer for abbreviated length
|
|
60
|
-
#
|
|
59
|
+
# See https://git-scm.com/docs/git-show-ref#Documentation/git-show-ref.txt---hashn
|
|
61
60
|
flag_or_value_option %i[hash s], inline: true
|
|
62
61
|
|
|
63
62
|
# Abbreviate object names; pass `true` for default or integer for explicit length
|
|
64
|
-
#
|
|
63
|
+
# See https://git-scm.com/docs/git-show-ref#Documentation/git-show-ref.txt---abbrevlength
|
|
65
64
|
flag_or_value_option :abbrev, inline: true
|
|
66
65
|
|
|
67
66
|
execution_option :timeout
|
|
@@ -72,48 +71,51 @@ module Git
|
|
|
72
71
|
operand :ref, repeatable: true, required: true
|
|
73
72
|
end
|
|
74
73
|
|
|
75
|
-
#
|
|
74
|
+
# @overload call(*ref, **options)
|
|
76
75
|
#
|
|
77
|
-
#
|
|
76
|
+
# Execute `git show-ref --verify` to verify refs by their full name
|
|
78
77
|
#
|
|
79
|
-
#
|
|
78
|
+
# @param ref [Array<String>] one or more fully-qualified ref names
|
|
80
79
|
#
|
|
81
|
-
#
|
|
80
|
+
# Each name must begin with `refs/` (or be `HEAD`). At least one is required.
|
|
82
81
|
#
|
|
83
|
-
#
|
|
82
|
+
# @param options [Hash] command options
|
|
84
83
|
#
|
|
85
|
-
#
|
|
84
|
+
# @option options [Boolean, nil] :quiet (nil) suppress all output
|
|
86
85
|
#
|
|
87
|
-
#
|
|
86
|
+
# Useful when you only care whether the ref exists.
|
|
88
87
|
#
|
|
89
|
-
#
|
|
88
|
+
# Alias: `:q`
|
|
90
89
|
#
|
|
91
|
-
#
|
|
90
|
+
# @option options [Boolean, nil] :dereference (nil) dereference annotated tags,
|
|
91
|
+
# emitting an extra `^{}` line per tag
|
|
92
92
|
#
|
|
93
|
-
#
|
|
94
|
-
# emitting an extra `^{}` line per tag
|
|
93
|
+
# Alias: `:d`
|
|
95
94
|
#
|
|
96
|
-
#
|
|
95
|
+
# @option options [Boolean, Integer, nil] :hash (nil) show only the SHA part
|
|
97
96
|
#
|
|
98
|
-
#
|
|
97
|
+
# Pass `true` for full-length SHAs or an integer for abbreviation length.
|
|
99
98
|
#
|
|
100
|
-
#
|
|
99
|
+
# Alias: `:s`
|
|
101
100
|
#
|
|
102
|
-
#
|
|
101
|
+
# @option options [Boolean, Integer, nil] :abbrev (nil) abbreviate object names
|
|
103
102
|
#
|
|
104
|
-
#
|
|
103
|
+
# Pass `true` for the default length or an integer for a specific length.
|
|
105
104
|
#
|
|
106
|
-
#
|
|
105
|
+
# @option options [Numeric] :timeout (nil) abort the command after this many
|
|
106
|
+
# seconds
|
|
107
107
|
#
|
|
108
|
-
#
|
|
109
|
-
# seconds
|
|
108
|
+
# @return [Git::CommandLine::Result] the result of calling `git show-ref --verify`
|
|
110
109
|
#
|
|
111
|
-
#
|
|
110
|
+
# @raise [ArgumentError] if unsupported options are provided
|
|
112
111
|
#
|
|
113
|
-
#
|
|
112
|
+
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
114
113
|
#
|
|
115
|
-
#
|
|
114
|
+
# @api public
|
|
116
115
|
#
|
|
116
|
+
def call(*, **)
|
|
117
|
+
super
|
|
118
|
+
end
|
|
117
119
|
end
|
|
118
120
|
end
|
|
119
121
|
end
|
|
@@ -21,10 +21,6 @@ module Git
|
|
|
21
21
|
# - {ShowRef::Exists} — boolean existence check without output (git >= 2.43)
|
|
22
22
|
# (`git show-ref --exists <ref>`)
|
|
23
23
|
#
|
|
24
|
-
# @api private
|
|
25
|
-
#
|
|
26
|
-
# @see https://git-scm.com/docs/git-show-ref git-show-ref documentation
|
|
27
|
-
#
|
|
28
24
|
# @example List all refs matching a pattern
|
|
29
25
|
# cmd = Git::Commands::ShowRef::List.new(execution_context)
|
|
30
26
|
# result = cmd.call('refs/tags/', tags: true)
|
|
@@ -36,6 +32,10 @@ module Git
|
|
|
36
32
|
# result = cmd.call('refs/heads/main')
|
|
37
33
|
# result.stdout # => "abc1234 refs/heads/main\n"
|
|
38
34
|
#
|
|
35
|
+
# @see https://git-scm.com/docs/git-show-ref git-show-ref documentation
|
|
36
|
+
#
|
|
37
|
+
# @api private
|
|
38
|
+
#
|
|
39
39
|
module ShowRef
|
|
40
40
|
end
|
|
41
41
|
end
|
|
@@ -10,14 +10,6 @@ module Git
|
|
|
10
10
|
# Applies the changes recorded in a stash to the working tree.
|
|
11
11
|
# Unlike {Pop}, this does not remove the stash from the stash list.
|
|
12
12
|
#
|
|
13
|
-
# @note `arguments` block audited against https://git-scm.com/docs/git-stash/2.53.0
|
|
14
|
-
#
|
|
15
|
-
# @see Git::Commands::Stash Git::Commands::Stash for usage examples
|
|
16
|
-
#
|
|
17
|
-
# @see https://git-scm.com/docs/git-stash git-stash documentation
|
|
18
|
-
#
|
|
19
|
-
# @api private
|
|
20
|
-
#
|
|
21
13
|
# @example Apply the latest stash
|
|
22
14
|
# Git::Commands::Stash::Apply.new(execution_context).call
|
|
23
15
|
#
|
|
@@ -27,6 +19,14 @@ module Git
|
|
|
27
19
|
# @example Apply and restore index state
|
|
28
20
|
# Git::Commands::Stash::Apply.new(execution_context).call(index: true)
|
|
29
21
|
#
|
|
22
|
+
# @note `arguments` block audited against https://git-scm.com/docs/git-stash/2.53.0
|
|
23
|
+
#
|
|
24
|
+
# @see Git::Commands::Stash Git::Commands::Stash for usage examples
|
|
25
|
+
#
|
|
26
|
+
# @see https://git-scm.com/docs/git-stash git-stash documentation
|
|
27
|
+
#
|
|
28
|
+
# @api private
|
|
29
|
+
#
|
|
30
30
|
class Apply < Git::Commands::Base
|
|
31
31
|
arguments do
|
|
32
32
|
literal 'stash'
|
|
@@ -36,39 +36,45 @@ module Git
|
|
|
36
36
|
operand :stash
|
|
37
37
|
end
|
|
38
38
|
|
|
39
|
-
#
|
|
39
|
+
# @overload call(**options)
|
|
40
|
+
#
|
|
41
|
+
# Apply the latest stash
|
|
40
42
|
#
|
|
41
|
-
#
|
|
43
|
+
# @param options [Hash] command options
|
|
42
44
|
#
|
|
43
|
-
# @
|
|
45
|
+
# @option options [Boolean, nil] :index (nil) restore the index state as well
|
|
44
46
|
#
|
|
45
|
-
#
|
|
47
|
+
# @option options [Boolean, nil] :quiet (nil) suppress informational messages
|
|
46
48
|
#
|
|
47
|
-
#
|
|
49
|
+
# Alias: :q
|
|
48
50
|
#
|
|
49
|
-
#
|
|
51
|
+
# @raise [ArgumentError] if unsupported options are provided
|
|
50
52
|
#
|
|
51
|
-
#
|
|
53
|
+
# @overload call(stash, **options)
|
|
52
54
|
#
|
|
53
|
-
#
|
|
55
|
+
# Apply a specific stash
|
|
54
56
|
#
|
|
55
|
-
# @
|
|
57
|
+
# @param stash [String] stash reference (e.g., 'stash@\\{0}', '0')
|
|
56
58
|
#
|
|
57
|
-
#
|
|
59
|
+
# @param options [Hash] command options
|
|
58
60
|
#
|
|
59
|
-
#
|
|
61
|
+
# @option options [Boolean, nil] :index (nil) restore the index state as well
|
|
60
62
|
#
|
|
61
|
-
#
|
|
63
|
+
# @option options [Boolean, nil] :quiet (nil) suppress informational messages
|
|
62
64
|
#
|
|
63
|
-
#
|
|
65
|
+
# Alias: :q
|
|
64
66
|
#
|
|
65
|
-
#
|
|
67
|
+
# @raise [ArgumentError] if unsupported options are provided
|
|
66
68
|
#
|
|
67
|
-
#
|
|
69
|
+
# @return [Git::CommandLine::Result] the result of calling `git stash apply`
|
|
68
70
|
#
|
|
69
|
-
#
|
|
71
|
+
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
70
72
|
#
|
|
71
|
-
#
|
|
73
|
+
# @api public
|
|
74
|
+
#
|
|
75
|
+
def call(*, **)
|
|
76
|
+
super
|
|
77
|
+
end
|
|
72
78
|
end
|
|
73
79
|
end
|
|
74
80
|
end
|
|
@@ -16,6 +16,12 @@ module Git
|
|
|
16
16
|
# be created at the commit that was HEAD when the stash was created, so
|
|
17
17
|
# applying the stash should succeed.
|
|
18
18
|
#
|
|
19
|
+
# @example Create branch from latest stash
|
|
20
|
+
# Git::Commands::Stash::Branch.new(execution_context).call('my-branch')
|
|
21
|
+
#
|
|
22
|
+
# @example Create branch from specific stash
|
|
23
|
+
# Git::Commands::Stash::Branch.new(execution_context).call('my-branch', 'stash@{2}')
|
|
24
|
+
#
|
|
19
25
|
# @note `arguments` block audited against https://git-scm.com/docs/git-stash/2.53.0
|
|
20
26
|
#
|
|
21
27
|
# @see Git::Commands::Stash Git::Commands::Stash for usage examples
|
|
@@ -24,12 +30,6 @@ module Git
|
|
|
24
30
|
#
|
|
25
31
|
# @api private
|
|
26
32
|
#
|
|
27
|
-
# @example Create branch from latest stash
|
|
28
|
-
# Git::Commands::Stash::Branch.new(execution_context).call('my-branch')
|
|
29
|
-
#
|
|
30
|
-
# @example Create branch from specific stash
|
|
31
|
-
# Git::Commands::Stash::Branch.new(execution_context).call('my-branch', 'stash@{2}')
|
|
32
|
-
#
|
|
33
33
|
class Branch < Git::Commands::Base
|
|
34
34
|
arguments do
|
|
35
35
|
literal 'stash'
|
|
@@ -38,7 +38,7 @@ module Git
|
|
|
38
38
|
operand :stash
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
-
# @!method call(
|
|
41
|
+
# @!method call(*)
|
|
42
42
|
#
|
|
43
43
|
# Create a branch from a stash entry
|
|
44
44
|
#
|
|
@@ -56,9 +56,11 @@ module Git
|
|
|
56
56
|
#
|
|
57
57
|
# @param stash [String] stash reference (e.g., 'stash@\\{0}', '0')
|
|
58
58
|
#
|
|
59
|
-
# @return [Git::
|
|
59
|
+
# @return [Git::CommandLine::Result] the result of calling `git stash branch`
|
|
60
60
|
#
|
|
61
61
|
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
62
|
+
#
|
|
63
|
+
# @api public
|
|
62
64
|
end
|
|
63
65
|
end
|
|
64
66
|
end
|
|
@@ -9,6 +9,9 @@ module Git
|
|
|
9
9
|
#
|
|
10
10
|
# Removes all stash entries. Use with caution as this cannot be undone.
|
|
11
11
|
#
|
|
12
|
+
# @example Clear all stashes
|
|
13
|
+
# Git::Commands::Stash::Clear.new(execution_context).call
|
|
14
|
+
#
|
|
12
15
|
# @note `arguments` block audited against https://git-scm.com/docs/git-stash/2.53.0
|
|
13
16
|
#
|
|
14
17
|
# @see Git::Commands::Stash Git::Commands::Stash for usage examples
|
|
@@ -17,24 +20,23 @@ module Git
|
|
|
17
20
|
#
|
|
18
21
|
# @api private
|
|
19
22
|
#
|
|
20
|
-
# @example Clear all stashes
|
|
21
|
-
# Git::Commands::Stash::Clear.new(execution_context).call
|
|
22
|
-
#
|
|
23
23
|
class Clear < Git::Commands::Base
|
|
24
24
|
arguments do
|
|
25
25
|
literal 'stash'
|
|
26
26
|
literal 'clear'
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
# @!method call(
|
|
29
|
+
# @!method call(*)
|
|
30
30
|
#
|
|
31
31
|
# @overload call()
|
|
32
32
|
#
|
|
33
33
|
# Clear all stash entries
|
|
34
34
|
#
|
|
35
|
-
# @return [Git::
|
|
35
|
+
# @return [Git::CommandLine::Result] the result of calling `git stash clear`
|
|
36
36
|
#
|
|
37
37
|
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
38
|
+
#
|
|
39
|
+
# @api public
|
|
38
40
|
end
|
|
39
41
|
end
|
|
40
42
|
end
|
|
@@ -14,6 +14,12 @@ module Git
|
|
|
14
14
|
# The command creates a stash commit and outputs its SHA, but does not
|
|
15
15
|
# update refs/stash. Use {Store} to store the commit in the stash reflog.
|
|
16
16
|
#
|
|
17
|
+
# @example Create a stash commit
|
|
18
|
+
# Git::Commands::Stash::Create.new(execution_context).call
|
|
19
|
+
#
|
|
20
|
+
# @example Create a stash commit with a message
|
|
21
|
+
# Git::Commands::Stash::Create.new(execution_context).call('WIP: my changes')
|
|
22
|
+
#
|
|
17
23
|
# @note `arguments` block audited against https://git-scm.com/docs/git-stash/2.53.0
|
|
18
24
|
#
|
|
19
25
|
# @see Git::Commands::Stash Git::Commands::Stash for usage examples
|
|
@@ -22,12 +28,6 @@ module Git
|
|
|
22
28
|
#
|
|
23
29
|
# @api private
|
|
24
30
|
#
|
|
25
|
-
# @example Create a stash commit
|
|
26
|
-
# Git::Commands::Stash::Create.new(execution_context).call
|
|
27
|
-
#
|
|
28
|
-
# @example Create a stash commit with a message
|
|
29
|
-
# Git::Commands::Stash::Create.new(execution_context).call('WIP: my changes')
|
|
30
|
-
#
|
|
31
31
|
class Create < Git::Commands::Base
|
|
32
32
|
arguments do
|
|
33
33
|
literal 'stash'
|
|
@@ -35,7 +35,7 @@ module Git
|
|
|
35
35
|
operand :message
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
# @!method call(
|
|
38
|
+
# @!method call(*)
|
|
39
39
|
#
|
|
40
40
|
# Create a stash commit
|
|
41
41
|
#
|
|
@@ -49,9 +49,11 @@ module Git
|
|
|
49
49
|
#
|
|
50
50
|
# @param message [String] optional message for the stash commit
|
|
51
51
|
#
|
|
52
|
-
# @return [Git::
|
|
52
|
+
# @return [Git::CommandLine::Result] the result of calling `git stash create`
|
|
53
53
|
#
|
|
54
54
|
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
55
|
+
#
|
|
56
|
+
# @api public
|
|
55
57
|
end
|
|
56
58
|
end
|
|
57
59
|
end
|
|
@@ -10,6 +10,12 @@ module Git
|
|
|
10
10
|
# Removes a single stash entry from the list of stash entries.
|
|
11
11
|
# If no stash reference is given, it removes the latest one.
|
|
12
12
|
#
|
|
13
|
+
# @example Drop the latest stash
|
|
14
|
+
# Git::Commands::Stash::Drop.new(execution_context).call
|
|
15
|
+
#
|
|
16
|
+
# @example Drop a specific stash
|
|
17
|
+
# Git::Commands::Stash::Drop.new(execution_context).call('stash@\\{2}')
|
|
18
|
+
#
|
|
13
19
|
# @note `arguments` block audited against https://git-scm.com/docs/git-stash/2.53.0
|
|
14
20
|
#
|
|
15
21
|
# @see Git::Commands::Stash Git::Commands::Stash for usage examples
|
|
@@ -18,12 +24,6 @@ module Git
|
|
|
18
24
|
#
|
|
19
25
|
# @api private
|
|
20
26
|
#
|
|
21
|
-
# @example Drop the latest stash
|
|
22
|
-
# Git::Commands::Stash::Drop.new(execution_context).call
|
|
23
|
-
#
|
|
24
|
-
# @example Drop a specific stash
|
|
25
|
-
# Git::Commands::Stash::Drop.new(execution_context).call('stash@\\{2}')
|
|
26
|
-
#
|
|
27
27
|
class Drop < Git::Commands::Base
|
|
28
28
|
arguments do
|
|
29
29
|
literal 'stash'
|
|
@@ -32,7 +32,7 @@ module Git
|
|
|
32
32
|
operand :stash
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
-
# @!method call(
|
|
35
|
+
# @!method call(*)
|
|
36
36
|
#
|
|
37
37
|
# Drop a stash entry
|
|
38
38
|
#
|
|
@@ -46,6 +46,8 @@ module Git
|
|
|
46
46
|
#
|
|
47
47
|
# Alias: :q
|
|
48
48
|
#
|
|
49
|
+
# @raise [ArgumentError] if unsupported options are provided
|
|
50
|
+
#
|
|
49
51
|
# @overload call(stash, **options)
|
|
50
52
|
#
|
|
51
53
|
# Drop a specific stash
|
|
@@ -58,9 +60,13 @@ module Git
|
|
|
58
60
|
#
|
|
59
61
|
# Alias: :q
|
|
60
62
|
#
|
|
61
|
-
#
|
|
63
|
+
# @raise [ArgumentError] if unsupported options are provided
|
|
64
|
+
#
|
|
65
|
+
# @return [Git::CommandLine::Result] the result of calling `git stash drop`
|
|
66
|
+
#
|
|
67
|
+
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
62
68
|
#
|
|
63
|
-
# @
|
|
69
|
+
# @api public
|
|
64
70
|
end
|
|
65
71
|
end
|
|
66
72
|
end
|
|
@@ -8,6 +8,9 @@ module Git
|
|
|
8
8
|
module Stash
|
|
9
9
|
# List all stash entries
|
|
10
10
|
#
|
|
11
|
+
# @example List all stashes
|
|
12
|
+
# Git::Commands::Stash::List.new(execution_context).call
|
|
13
|
+
#
|
|
11
14
|
# @note `arguments` block audited against https://git-scm.com/docs/git-stash/2.53.0
|
|
12
15
|
#
|
|
13
16
|
# @see Git::Commands::Stash Git::Commands::Stash for usage examples
|
|
@@ -16,9 +19,6 @@ module Git
|
|
|
16
19
|
#
|
|
17
20
|
# @api private
|
|
18
21
|
#
|
|
19
|
-
# @example List all stashes
|
|
20
|
-
# Git::Commands::Stash::List.new(execution_context).call
|
|
21
|
-
#
|
|
22
22
|
class List < Git::Commands::Base
|
|
23
23
|
arguments do
|
|
24
24
|
literal 'stash'
|
|
@@ -26,13 +26,17 @@ module Git
|
|
|
26
26
|
literal "--format=#{Git::Parsers::Stash::STASH_FORMAT}"
|
|
27
27
|
end
|
|
28
28
|
|
|
29
|
-
# @!method call(
|
|
29
|
+
# @!method call(*)
|
|
30
30
|
#
|
|
31
31
|
# List all stash entries
|
|
32
32
|
#
|
|
33
33
|
# @overload call()
|
|
34
34
|
#
|
|
35
|
-
# @return [Git::
|
|
35
|
+
# @return [Git::CommandLine::Result] the result of calling `git stash list`
|
|
36
|
+
#
|
|
37
|
+
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
38
|
+
#
|
|
39
|
+
# @api public
|
|
36
40
|
end
|
|
37
41
|
end
|
|
38
42
|
end
|