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
|
@@ -57,105 +57,121 @@ module Git
|
|
|
57
57
|
operand :pattern, repeatable: true
|
|
58
58
|
end
|
|
59
59
|
|
|
60
|
-
#
|
|
60
|
+
# @overload call(*pattern, **options)
|
|
61
61
|
#
|
|
62
|
-
#
|
|
62
|
+
# Execute the `git branch --list` command
|
|
63
63
|
#
|
|
64
|
-
#
|
|
64
|
+
# @param pattern [Array<String>] shell wildcard patterns to filter branches
|
|
65
65
|
#
|
|
66
|
-
#
|
|
66
|
+
# If multiple patterns are given, a branch is shown if it matches any
|
|
67
|
+
# of the patterns
|
|
67
68
|
#
|
|
68
|
-
#
|
|
69
|
+
# @param options [Hash] command options
|
|
69
70
|
#
|
|
70
|
-
#
|
|
71
|
+
# @option options [Boolean, String, nil] :color (nil) color branches output
|
|
71
72
|
#
|
|
72
|
-
#
|
|
73
|
+
# Pass `true` for `--color` or a string (`'always'`, `'never'`,
|
|
74
|
+
# `'auto'`) for `--color=<when>`
|
|
73
75
|
#
|
|
74
|
-
#
|
|
76
|
+
# @option options [Boolean, nil] :no_color (nil) suppress colored output
|
|
77
|
+
# (`--no-color`)
|
|
75
78
|
#
|
|
76
|
-
#
|
|
79
|
+
# @option options [Boolean, Integer, nil] :verbose (nil) show sha1 and
|
|
80
|
+
# commit subject for each branch
|
|
77
81
|
#
|
|
78
|
-
#
|
|
79
|
-
#
|
|
82
|
+
# Pass `true` for `--verbose` (show sha1 and subject); pass `2` for
|
|
83
|
+
# `--verbose --verbose` (also show the linked worktree path and
|
|
84
|
+
# upstream branch name)
|
|
80
85
|
#
|
|
81
|
-
#
|
|
82
|
-
# `--verbose --verbose` (also show the linked worktree path and upstream
|
|
83
|
-
# branch name).
|
|
86
|
+
# Alias: :v
|
|
84
87
|
#
|
|
85
|
-
#
|
|
88
|
+
# @option options [Boolean, Integer, nil] :abbrev (nil) minimum sha1
|
|
89
|
+
# display length when used with verbose mode
|
|
86
90
|
#
|
|
87
|
-
#
|
|
88
|
-
#
|
|
91
|
+
# Pass an integer for `--abbrev=<n>` or `true` for `--abbrev`
|
|
92
|
+
# (default length)
|
|
89
93
|
#
|
|
90
|
-
#
|
|
94
|
+
# @option options [Boolean, nil] :no_abbrev (nil) show full sha1s
|
|
95
|
+
# (`--no-abbrev`)
|
|
91
96
|
#
|
|
92
|
-
#
|
|
97
|
+
# @option options [Boolean, String, nil] :column (nil) display branch
|
|
98
|
+
# listing in columns
|
|
93
99
|
#
|
|
94
|
-
#
|
|
95
|
-
#
|
|
100
|
+
# Pass `true` for `--column` or a string of options for
|
|
101
|
+
# `--column=<options>`
|
|
96
102
|
#
|
|
97
|
-
#
|
|
98
|
-
# Only applicable in non-verbose mode.
|
|
103
|
+
# Only applicable in non-verbose mode
|
|
99
104
|
#
|
|
100
|
-
#
|
|
105
|
+
# @option options [Boolean, nil] :no_column (nil) disable column output
|
|
106
|
+
# (`--no-column`)
|
|
101
107
|
#
|
|
102
|
-
#
|
|
103
|
-
#
|
|
108
|
+
# @option options [String, Array<String>] :sort (nil) sort branches by
|
|
109
|
+
# the specified key(s)
|
|
104
110
|
#
|
|
105
|
-
#
|
|
106
|
-
#
|
|
111
|
+
# Give an array to add multiple --sort options
|
|
112
|
+
# Prefix each key with '-' for descending order
|
|
113
|
+
# For example, sort: ['refname', '-committerdate']
|
|
107
114
|
#
|
|
108
|
-
#
|
|
109
|
-
#
|
|
115
|
+
# @option options [Boolean, String, nil] :merged (nil) list only branches
|
|
116
|
+
# merged into the specified commit
|
|
110
117
|
#
|
|
111
|
-
#
|
|
112
|
-
#
|
|
118
|
+
# Pass `true` to default to HEAD or a commit ref string to filter by
|
|
119
|
+
# that commit
|
|
113
120
|
#
|
|
114
|
-
#
|
|
115
|
-
#
|
|
121
|
+
# @option options [Boolean, String, nil] :no_merged (nil) list only
|
|
122
|
+
# branches not merged into the specified commit
|
|
116
123
|
#
|
|
117
|
-
#
|
|
118
|
-
#
|
|
124
|
+
# Pass `true` to default to HEAD or a commit ref string to filter by
|
|
125
|
+
# that commit
|
|
119
126
|
#
|
|
120
|
-
#
|
|
121
|
-
#
|
|
127
|
+
# @option options [Boolean, String, nil] :contains (nil) list only
|
|
128
|
+
# branches that contain the specified commit
|
|
122
129
|
#
|
|
123
|
-
#
|
|
124
|
-
#
|
|
130
|
+
# Pass `true` to default to HEAD or a commit ref string to filter by
|
|
131
|
+
# that commit
|
|
125
132
|
#
|
|
126
|
-
#
|
|
127
|
-
#
|
|
133
|
+
# @option options [Boolean, String, nil] :no_contains (nil) list only
|
|
134
|
+
# branches that don't contain the specified commit
|
|
128
135
|
#
|
|
129
|
-
#
|
|
130
|
-
#
|
|
136
|
+
# Pass `true` to default to HEAD or a commit ref string to filter by
|
|
137
|
+
# that commit
|
|
131
138
|
#
|
|
132
|
-
#
|
|
133
|
-
#
|
|
139
|
+
# @option options [String] :points_at (nil) list only branches that
|
|
140
|
+
# point at the specified object
|
|
134
141
|
#
|
|
135
|
-
#
|
|
142
|
+
# @option options [String] :format (nil) output format string for each
|
|
143
|
+
# branch
|
|
136
144
|
#
|
|
137
|
-
#
|
|
138
|
-
#
|
|
145
|
+
# @option options [Boolean, nil] :remotes (nil) list only remote-tracking
|
|
146
|
+
# branches
|
|
139
147
|
#
|
|
140
|
-
#
|
|
148
|
+
# Alias: :r
|
|
141
149
|
#
|
|
142
|
-
#
|
|
150
|
+
# @option options [Boolean, nil] :all (nil) list both local and remote
|
|
151
|
+
# branches
|
|
143
152
|
#
|
|
144
|
-
#
|
|
153
|
+
# Alias: :a
|
|
145
154
|
#
|
|
146
|
-
#
|
|
147
|
-
#
|
|
155
|
+
# @option options [Boolean, nil] :ignore_case (nil) sort and filter
|
|
156
|
+
# branches case insensitively
|
|
148
157
|
#
|
|
149
|
-
#
|
|
158
|
+
# Alias: :i
|
|
150
159
|
#
|
|
151
|
-
#
|
|
152
|
-
#
|
|
160
|
+
# @option options [Boolean, nil] :omit_empty (nil) do not print a
|
|
161
|
+
# newline after formatted refs where the format expands to the empty
|
|
162
|
+
# string
|
|
153
163
|
#
|
|
154
|
-
#
|
|
164
|
+
# @return [Git::CommandLine::Result] the result of calling `git branch --list`
|
|
155
165
|
#
|
|
156
|
-
#
|
|
166
|
+
# @raise [ArgumentError] if unsupported options are provided
|
|
157
167
|
#
|
|
158
|
-
#
|
|
168
|
+
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
169
|
+
#
|
|
170
|
+
# @api public
|
|
171
|
+
#
|
|
172
|
+
def call(*, **)
|
|
173
|
+
super
|
|
174
|
+
end
|
|
159
175
|
end
|
|
160
176
|
end
|
|
161
177
|
end
|
|
@@ -47,47 +47,55 @@ module Git
|
|
|
47
47
|
operand :new_branch, required: true
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
-
#
|
|
50
|
+
# Executes the git branch --move command to rename a branch
|
|
51
51
|
#
|
|
52
|
-
#
|
|
52
|
+
# @overload call(new_branch, **options)
|
|
53
53
|
#
|
|
54
|
-
#
|
|
54
|
+
# Rename the current branch to new_branch
|
|
55
55
|
#
|
|
56
|
-
#
|
|
56
|
+
# @param new_branch [String] the new name for the branch
|
|
57
57
|
#
|
|
58
|
-
#
|
|
58
|
+
# @param options [Hash] command options
|
|
59
59
|
#
|
|
60
|
-
#
|
|
60
|
+
# @option options [Boolean, nil] :force (nil) allow renaming even if new_branch already
|
|
61
|
+
# exists
|
|
61
62
|
#
|
|
62
|
-
#
|
|
63
|
+
# Alias: :f
|
|
63
64
|
#
|
|
64
|
-
#
|
|
65
|
+
# @return [Git::CommandLine::Result] the result of calling `git branch --move`
|
|
65
66
|
#
|
|
66
|
-
#
|
|
67
|
+
# @raise [ArgumentError] if unsupported options are provided
|
|
67
68
|
#
|
|
68
|
-
#
|
|
69
|
+
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
69
70
|
#
|
|
70
|
-
#
|
|
71
|
+
# @api public
|
|
71
72
|
#
|
|
72
|
-
#
|
|
73
|
+
# @overload call(old_branch, new_branch, **options)
|
|
73
74
|
#
|
|
74
|
-
#
|
|
75
|
+
# Rename old_branch to new_branch
|
|
75
76
|
#
|
|
76
|
-
#
|
|
77
|
+
# @param old_branch [String] the current name of the branch
|
|
77
78
|
#
|
|
78
|
-
#
|
|
79
|
+
# @param new_branch [String] the new name for the branch
|
|
79
80
|
#
|
|
80
|
-
#
|
|
81
|
+
# @param options [Hash] command options
|
|
81
82
|
#
|
|
82
|
-
#
|
|
83
|
+
# @option options [Boolean, nil] :force (nil) allow renaming even if new_branch already
|
|
84
|
+
# exists
|
|
83
85
|
#
|
|
84
|
-
#
|
|
86
|
+
# Alias: :f
|
|
85
87
|
#
|
|
86
|
-
#
|
|
88
|
+
# @return [Git::CommandLine::Result] the result of calling `git branch --move`
|
|
87
89
|
#
|
|
88
|
-
#
|
|
90
|
+
# @raise [ArgumentError] if unsupported options are provided
|
|
89
91
|
#
|
|
90
|
-
#
|
|
92
|
+
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
93
|
+
#
|
|
94
|
+
# @api public
|
|
95
|
+
#
|
|
96
|
+
def call(*, **)
|
|
97
|
+
super
|
|
98
|
+
end
|
|
91
99
|
end
|
|
92
100
|
end
|
|
93
101
|
end
|
|
@@ -39,21 +39,20 @@ module Git
|
|
|
39
39
|
operand :branch_name
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
# @!method call(
|
|
43
|
-
#
|
|
44
|
-
# Execute the git branch --set-upstream-to command
|
|
42
|
+
# @!method call(*)
|
|
45
43
|
#
|
|
46
44
|
# @overload call(**options)
|
|
47
45
|
#
|
|
48
|
-
#
|
|
46
|
+
# Set upstream for the current branch
|
|
49
47
|
#
|
|
50
48
|
# @param options [Hash] command options
|
|
51
49
|
#
|
|
52
|
-
# @option options [String] :set_upstream_to (required)
|
|
50
|
+
# @option options [String] :set_upstream_to (required)
|
|
51
|
+
# upstream branch to set (e.g., `origin/main`)
|
|
53
52
|
#
|
|
54
53
|
# Alias: :u
|
|
55
54
|
#
|
|
56
|
-
# @return [Git::
|
|
55
|
+
# @return [Git::CommandLine::Result] the result of calling `git branch --set-upstream-to`
|
|
57
56
|
#
|
|
58
57
|
# @raise [ArgumentError] if set_upstream_to is not provided
|
|
59
58
|
#
|
|
@@ -69,11 +68,12 @@ module Git
|
|
|
69
68
|
#
|
|
70
69
|
# @param options [Hash] command options
|
|
71
70
|
#
|
|
72
|
-
# @option options [String] :set_upstream_to (required)
|
|
71
|
+
# @option options [String] :set_upstream_to (required)
|
|
72
|
+
# upstream branch to set (e.g., `origin/main`)
|
|
73
73
|
#
|
|
74
74
|
# Alias: :u
|
|
75
75
|
#
|
|
76
|
-
# @return [Git::
|
|
76
|
+
# @return [Git::CommandLine::Result] the result of calling `git branch --set-upstream-to`
|
|
77
77
|
#
|
|
78
78
|
# @raise [ArgumentError] if set_upstream_to is not provided
|
|
79
79
|
#
|
|
@@ -34,13 +34,13 @@ module Git
|
|
|
34
34
|
literal '--show-current'
|
|
35
35
|
end
|
|
36
36
|
|
|
37
|
-
# @!method call(
|
|
37
|
+
# @!method call(*)
|
|
38
38
|
#
|
|
39
39
|
# @overload call()
|
|
40
40
|
#
|
|
41
|
-
# Execute the git branch --show-current command
|
|
41
|
+
# Execute the `git branch --show-current` command
|
|
42
42
|
#
|
|
43
|
-
# @return [Git::
|
|
43
|
+
# @return [Git::CommandLine::Result] the result of calling `git branch --show-current`
|
|
44
44
|
#
|
|
45
45
|
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
46
46
|
end
|
|
@@ -35,20 +35,16 @@ module Git
|
|
|
35
35
|
operand :branch_name
|
|
36
36
|
end
|
|
37
37
|
|
|
38
|
-
# @!method call(
|
|
38
|
+
# @!method call(*)
|
|
39
39
|
#
|
|
40
|
-
# @overload call(branch_name = nil
|
|
40
|
+
# @overload call(branch_name = nil)
|
|
41
41
|
#
|
|
42
|
-
# Execute the `git branch --unset-upstream` command
|
|
42
|
+
# Execute the `git branch --unset-upstream` command
|
|
43
43
|
#
|
|
44
44
|
# @param branch_name [String, nil] the branch to remove upstream tracking for
|
|
45
45
|
# (defaults to current branch if omitted)
|
|
46
46
|
#
|
|
47
|
-
# @
|
|
48
|
-
#
|
|
49
|
-
# @return [Git::CommandLineResult] the result of calling `git branch --unset-upstream`
|
|
50
|
-
#
|
|
51
|
-
# @raise [ArgumentError] if unsupported options are provided
|
|
47
|
+
# @return [Git::CommandLine::Result] the result of calling `git branch --unset-upstream`
|
|
52
48
|
#
|
|
53
49
|
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
54
50
|
end
|
data/lib/git/commands/branch.rb
CHANGED
|
@@ -24,10 +24,10 @@ module Git
|
|
|
24
24
|
# - {Branch::SetUpstream} — set upstream tracking (`--set-upstream-to`)
|
|
25
25
|
# - {Branch::UnsetUpstream} — remove upstream tracking (`--unset-upstream`)
|
|
26
26
|
#
|
|
27
|
-
# @api private
|
|
28
|
-
#
|
|
29
27
|
# @see https://git-scm.com/docs/git-branch git-branch documentation
|
|
30
28
|
#
|
|
29
|
+
# @api private
|
|
30
|
+
#
|
|
31
31
|
module Branch
|
|
32
32
|
end
|
|
33
33
|
end
|
|
@@ -32,12 +32,12 @@ module Git
|
|
|
32
32
|
# For single-object queries, use {CatFile::Raw}.
|
|
33
33
|
# For filter-processed content, use {CatFile::Filtered}.
|
|
34
34
|
#
|
|
35
|
+
# @note `arguments` block audited against https://git-scm.com/docs/git-cat-file/2.53.0
|
|
36
|
+
#
|
|
35
37
|
# @see Git::Commands::CatFile
|
|
36
38
|
#
|
|
37
39
|
# @see https://git-scm.com/docs/git-cat-file git-cat-file documentation
|
|
38
40
|
#
|
|
39
|
-
# @note `arguments` block audited against https://git-scm.com/docs/git-cat-file/2.53.0
|
|
40
|
-
#
|
|
41
41
|
# @api private
|
|
42
42
|
#
|
|
43
43
|
class Batch < Base
|
|
@@ -47,56 +47,56 @@ module Git
|
|
|
47
47
|
# Full content mode: header + raw bytes + newline separator per object;
|
|
48
48
|
# accepts a format string to customise the per-object output header
|
|
49
49
|
# (e.g. `"%(objectname) %(objecttype) %(objectsize)"`)
|
|
50
|
-
#
|
|
50
|
+
# See https://git-scm.com/docs/git-cat-file#Documentation/git-cat-file.txt---batch
|
|
51
51
|
flag_or_value_option :batch, inline: true
|
|
52
52
|
|
|
53
53
|
# Metadata-only mode: one `<sha> <type> <size>` line per object;
|
|
54
54
|
# accepts a format string to customise the per-object output line
|
|
55
|
-
#
|
|
55
|
+
# See https://git-scm.com/docs/git-cat-file#Documentation/git-cat-file.txt---batch-check
|
|
56
56
|
flag_or_value_option :batch_check, inline: true
|
|
57
57
|
|
|
58
58
|
# Command-dispatch mode: stdin carries `contents`/`info`/`flush` verbs;
|
|
59
59
|
# accepts a format string to customise the output of `info` and `contents` commands
|
|
60
|
-
#
|
|
60
|
+
# See https://git-scm.com/docs/git-cat-file#Documentation/git-cat-file.txt---batch-command
|
|
61
61
|
flag_or_value_option :batch_command, inline: true
|
|
62
62
|
|
|
63
63
|
# Enumerate all objects in the repository without reading stdin.
|
|
64
64
|
# Incompatible with `batch_command:`.
|
|
65
|
-
#
|
|
65
|
+
# See https://git-scm.com/docs/git-cat-file#Documentation/git-cat-file.txt---batch-all-objects
|
|
66
66
|
flag_option :batch_all_objects
|
|
67
67
|
|
|
68
68
|
# Use normal stdio buffering; enables explicit `flush` semantics when used
|
|
69
69
|
# with `batch_command:` and improves throughput with `batch_check:`
|
|
70
|
-
#
|
|
70
|
+
# See https://git-scm.com/docs/git-cat-file#Documentation/git-cat-file.txt---buffer
|
|
71
71
|
flag_option :buffer
|
|
72
72
|
|
|
73
73
|
# Follow symlinks inside the repository when traversing tree objects
|
|
74
|
-
#
|
|
74
|
+
# See https://git-scm.com/docs/git-cat-file#Documentation/git-cat-file.txt---follow-symlinks
|
|
75
75
|
flag_option :follow_symlinks
|
|
76
76
|
|
|
77
77
|
# Allow `--batch-all-objects` to output objects in an arbitrary, potentially
|
|
78
78
|
# faster order
|
|
79
|
-
#
|
|
79
|
+
# See https://git-scm.com/docs/git-cat-file#Documentation/git-cat-file.txt---unordered
|
|
80
80
|
flag_option :unordered
|
|
81
81
|
|
|
82
82
|
# Apply textconv filters to blob content (combine with `batch_command:`)
|
|
83
|
-
#
|
|
83
|
+
# See https://git-scm.com/docs/git-cat-file#Documentation/git-cat-file.txt---textconv
|
|
84
84
|
flag_option :textconv
|
|
85
85
|
|
|
86
86
|
# Apply the full working-tree filter pipeline (combine with `batch_command:`)
|
|
87
|
-
#
|
|
87
|
+
# See https://git-scm.com/docs/git-cat-file#Documentation/git-cat-file.txt---filters
|
|
88
88
|
flag_option :filters
|
|
89
89
|
|
|
90
90
|
# Map committer/author identities through mailmap for all batch modes
|
|
91
|
-
#
|
|
91
|
+
# See https://git-scm.com/docs/git-cat-file#Documentation/git-cat-file.txt---use-mailmap
|
|
92
92
|
flag_option :use_mailmap, negatable: true
|
|
93
93
|
|
|
94
94
|
# Omit objects matching the filter spec from the output (batched modes only)
|
|
95
|
-
#
|
|
95
|
+
# See https://git-scm.com/docs/git-cat-file#Documentation/git-cat-file.txt---filterltfilter-specgt
|
|
96
96
|
value_option :filter, inline: true
|
|
97
97
|
|
|
98
98
|
# Use NUL-delimited input/output instead of newline-delimited
|
|
99
|
-
#
|
|
99
|
+
# See https://git-scm.com/docs/git-cat-file#Documentation/git-cat-file.txt--Z
|
|
100
100
|
flag_option :Z
|
|
101
101
|
|
|
102
102
|
# Stream stdout to this IO object instead of buffering in memory.
|
|
@@ -154,7 +154,7 @@ module Git
|
|
|
154
154
|
# @option options [#write, nil] :out (nil) stream stdout to this IO object
|
|
155
155
|
# instead of buffering in memory; when given, `result.stdout` will be `''`
|
|
156
156
|
#
|
|
157
|
-
# @return [Git::
|
|
157
|
+
# @return [Git::CommandLine::Result] the result of calling `git cat-file`
|
|
158
158
|
#
|
|
159
159
|
# Stdout contains the batch output stream (or `''` when `out:` is given)
|
|
160
160
|
#
|
|
@@ -196,7 +196,7 @@ module Git
|
|
|
196
196
|
# @option options [#write, nil] :out (nil) stream stdout to this IO object
|
|
197
197
|
# instead of buffering in memory; when given, `result.stdout` will be `''`
|
|
198
198
|
#
|
|
199
|
-
# @return [Git::
|
|
199
|
+
# @return [Git::CommandLine::Result] the result of calling `git cat-file`
|
|
200
200
|
#
|
|
201
201
|
# Stdout contains one metadata line per object (or `''` when `out:` is given)
|
|
202
202
|
#
|
|
@@ -236,7 +236,7 @@ module Git
|
|
|
236
236
|
# @option options [#write, nil] :out (nil) stream stdout to this IO object
|
|
237
237
|
# instead of buffering in memory; when given, `result.stdout` will be `''`
|
|
238
238
|
#
|
|
239
|
-
# @return [Git::
|
|
239
|
+
# @return [Git::CommandLine::Result] the result of calling `git cat-file`
|
|
240
240
|
#
|
|
241
241
|
# Stdout contains the interleaved command output (or `''` when `out:` is given)
|
|
242
242
|
#
|
|
@@ -270,7 +270,7 @@ module Git
|
|
|
270
270
|
# @option options [#write, nil] :out (nil) stream stdout to this IO object
|
|
271
271
|
# instead of buffering in memory; when given, `result.stdout` will be `''`
|
|
272
272
|
#
|
|
273
|
-
# @return [Git::
|
|
273
|
+
# @return [Git::CommandLine::Result] the result of calling `git cat-file`
|
|
274
274
|
#
|
|
275
275
|
# Stdout contains the full batch output (or `''` when `out:` is given)
|
|
276
276
|
#
|
|
@@ -307,7 +307,7 @@ module Git
|
|
|
307
307
|
#
|
|
308
308
|
# @option options [Numeric, nil] :timeout (nil) abort the command after this many seconds
|
|
309
309
|
#
|
|
310
|
-
# @return [Git::
|
|
310
|
+
# @return [Git::CommandLine::Result] the result of calling `git cat-file`
|
|
311
311
|
#
|
|
312
312
|
# Stdout contains one metadata line per object (or `''` when `out:` is given)
|
|
313
313
|
#
|
|
@@ -332,7 +332,7 @@ module Git
|
|
|
332
332
|
#
|
|
333
333
|
# @param reader [IO] read end of the stdin pipe
|
|
334
334
|
#
|
|
335
|
-
# @return [Git::
|
|
335
|
+
# @return [Git::CommandLine::Result]
|
|
336
336
|
#
|
|
337
337
|
def run_batch(bound, reader)
|
|
338
338
|
result = if bound.execution_options.key?(:out)
|
|
@@ -344,6 +344,14 @@ module Git
|
|
|
344
344
|
result
|
|
345
345
|
end
|
|
346
346
|
|
|
347
|
+
# Run the bound command using the streaming execution path
|
|
348
|
+
#
|
|
349
|
+
# @param bound [Git::Commands::Arguments::Bound] bound argument list
|
|
350
|
+
#
|
|
351
|
+
# @param reader [IO] read end of the stdin pipe
|
|
352
|
+
#
|
|
353
|
+
# @return [Git::CommandLine::Result] the command result
|
|
354
|
+
#
|
|
347
355
|
def run_batch_streaming(bound, reader)
|
|
348
356
|
@execution_context.command_streaming(
|
|
349
357
|
*bound,
|
|
@@ -353,6 +361,14 @@ module Git
|
|
|
353
361
|
)
|
|
354
362
|
end
|
|
355
363
|
|
|
364
|
+
# Run the bound command using the capturing execution path
|
|
365
|
+
#
|
|
366
|
+
# @param bound [Git::Commands::Arguments::Bound] bound argument list
|
|
367
|
+
#
|
|
368
|
+
# @param reader [IO] read end of the stdin pipe
|
|
369
|
+
#
|
|
370
|
+
# @return [Git::CommandLine::Result] the command result
|
|
371
|
+
#
|
|
356
372
|
def run_batch_capturing(bound, reader)
|
|
357
373
|
@execution_context.command_capturing(
|
|
358
374
|
*bound,
|
|
@@ -37,16 +37,16 @@ module Git
|
|
|
37
37
|
literal 'cat-file'
|
|
38
38
|
|
|
39
39
|
# Apply only the textconv filter (binary-to-text conversion)
|
|
40
|
-
#
|
|
40
|
+
# See https://git-scm.com/docs/git-cat-file#Documentation/git-cat-file.txt---textconv
|
|
41
41
|
flag_option :textconv
|
|
42
42
|
|
|
43
43
|
# Apply the full working-tree filter pipeline (smudge, EOL, textconv)
|
|
44
|
-
#
|
|
44
|
+
# See https://git-scm.com/docs/git-cat-file#Documentation/git-cat-file.txt---filters
|
|
45
45
|
flag_option :filters
|
|
46
46
|
|
|
47
47
|
# Specify the path separately when the rev is passed as a bare revision.
|
|
48
48
|
# When used, the `rev` operand must be a plain revision (not `<rev>:<path>`).
|
|
49
|
-
#
|
|
49
|
+
# See https://git-scm.com/docs/git-cat-file#Documentation/git-cat-file.txt---pathltpathgt
|
|
50
50
|
value_option :path, inline: true
|
|
51
51
|
|
|
52
52
|
end_of_options
|
|
@@ -56,9 +56,7 @@ module Git
|
|
|
56
56
|
operand :rev, required: true
|
|
57
57
|
end
|
|
58
58
|
|
|
59
|
-
# @!method call(
|
|
60
|
-
#
|
|
61
|
-
# Execute `git cat-file --textconv` or `git cat-file --filters`.
|
|
59
|
+
# @!method call(*)
|
|
62
60
|
#
|
|
63
61
|
# @overload call(rev, textconv: true, **options)
|
|
64
62
|
# Apply the textconv filter to a single object
|
|
@@ -70,15 +68,16 @@ module Git
|
|
|
70
68
|
#
|
|
71
69
|
# @param options [Hash] command options
|
|
72
70
|
#
|
|
73
|
-
# @option options [String] :path (nil)
|
|
71
|
+
# @option options [String] :path (nil)
|
|
72
|
+
# path to the blob when `rev` is a bare revision
|
|
74
73
|
#
|
|
75
|
-
# @return [Git::
|
|
74
|
+
# @return [Git::CommandLine::Result] the result of calling `git cat-file`
|
|
76
75
|
#
|
|
77
76
|
# Stdout contains the textconv-processed content
|
|
78
77
|
#
|
|
79
78
|
# @raise [ArgumentError] if unsupported options are provided
|
|
80
79
|
#
|
|
81
|
-
# @raise [Git::FailedError] if
|
|
80
|
+
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
82
81
|
#
|
|
83
82
|
# @overload call(rev, filters: true, **options)
|
|
84
83
|
# Apply the full working-tree filter pipeline to a single object
|
|
@@ -90,15 +89,16 @@ module Git
|
|
|
90
89
|
#
|
|
91
90
|
# @param options [Hash] command options
|
|
92
91
|
#
|
|
93
|
-
# @option options [String] :path (nil)
|
|
92
|
+
# @option options [String] :path (nil)
|
|
93
|
+
# path to the blob when `rev` is a bare revision
|
|
94
94
|
#
|
|
95
|
-
# @return [Git::
|
|
95
|
+
# @return [Git::CommandLine::Result] the result of calling `git cat-file`
|
|
96
96
|
#
|
|
97
97
|
# Stdout contains the filter-processed content
|
|
98
98
|
#
|
|
99
99
|
# @raise [ArgumentError] if unsupported options are provided
|
|
100
100
|
#
|
|
101
|
-
# @raise [Git::FailedError] if
|
|
101
|
+
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
102
102
|
end
|
|
103
103
|
end
|
|
104
104
|
end
|