git 4.4.6 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (275) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -0
  3. data/CHANGELOG.md +348 -39
  4. data/CONTRIBUTING.md +1014 -144
  5. data/README.md +386 -504
  6. data/UPGRADING.md +1822 -0
  7. data/git.gemspec +102 -22
  8. data/lib/git/author_info.rb +65 -0
  9. data/lib/git/branch_delete_failure.rb +34 -0
  10. data/lib/git/branch_delete_result.rb +66 -0
  11. data/lib/git/branch_info.rb +237 -0
  12. data/lib/git/command_line/base.rb +247 -0
  13. data/lib/git/command_line/capturing.rb +308 -0
  14. data/lib/git/command_line/result.rb +88 -0
  15. data/lib/git/command_line/streaming.rb +236 -0
  16. data/lib/git/command_line.rb +45 -323
  17. data/lib/git/commands/add.rb +139 -0
  18. data/lib/git/commands/am/abort.rb +43 -0
  19. data/lib/git/commands/am/apply.rb +263 -0
  20. data/lib/git/commands/am/continue.rb +43 -0
  21. data/lib/git/commands/am/quit.rb +43 -0
  22. data/lib/git/commands/am/retry.rb +49 -0
  23. data/lib/git/commands/am/show_current_patch.rb +64 -0
  24. data/lib/git/commands/am/skip.rb +42 -0
  25. data/lib/git/commands/am.rb +33 -0
  26. data/lib/git/commands/apply.rb +242 -0
  27. data/lib/git/commands/archive/list_formats.rb +46 -0
  28. data/lib/git/commands/archive.rb +145 -0
  29. data/lib/git/commands/arguments.rb +4521 -0
  30. data/lib/git/commands/base.rb +522 -0
  31. data/lib/git/commands/branch/copy.rb +102 -0
  32. data/lib/git/commands/branch/create.rb +177 -0
  33. data/lib/git/commands/branch/delete.rb +88 -0
  34. data/lib/git/commands/branch/list.rb +178 -0
  35. data/lib/git/commands/branch/move.rb +102 -0
  36. data/lib/git/commands/branch/set_upstream.rb +86 -0
  37. data/lib/git/commands/branch/show_current.rb +49 -0
  38. data/lib/git/commands/branch/unset_upstream.rb +53 -0
  39. data/lib/git/commands/branch.rb +34 -0
  40. data/lib/git/commands/cat_file/batch.rb +385 -0
  41. data/lib/git/commands/cat_file/filtered.rb +105 -0
  42. data/lib/git/commands/cat_file/raw.rb +203 -0
  43. data/lib/git/commands/cat_file.rb +49 -0
  44. data/lib/git/commands/checkout/branch.rb +153 -0
  45. data/lib/git/commands/checkout/files.rb +116 -0
  46. data/lib/git/commands/checkout.rb +38 -0
  47. data/lib/git/commands/checkout_index.rb +106 -0
  48. data/lib/git/commands/clean.rb +102 -0
  49. data/lib/git/commands/clone.rb +241 -0
  50. data/lib/git/commands/commit.rb +273 -0
  51. data/lib/git/commands/commit_tree.rb +101 -0
  52. data/lib/git/commands/config_option_syntax/add.rb +86 -0
  53. data/lib/git/commands/config_option_syntax/get.rb +121 -0
  54. data/lib/git/commands/config_option_syntax/get_all.rb +118 -0
  55. data/lib/git/commands/config_option_syntax/get_color.rb +95 -0
  56. data/lib/git/commands/config_option_syntax/get_color_bool.rb +96 -0
  57. data/lib/git/commands/config_option_syntax/get_regexp.rb +119 -0
  58. data/lib/git/commands/config_option_syntax/get_urlmatch.rb +111 -0
  59. data/lib/git/commands/config_option_syntax/list.rb +111 -0
  60. data/lib/git/commands/config_option_syntax/remove_section.rb +79 -0
  61. data/lib/git/commands/config_option_syntax/rename_section.rb +83 -0
  62. data/lib/git/commands/config_option_syntax/replace_all.rb +109 -0
  63. data/lib/git/commands/config_option_syntax/set.rb +119 -0
  64. data/lib/git/commands/config_option_syntax/unset.rb +92 -0
  65. data/lib/git/commands/config_option_syntax/unset_all.rb +94 -0
  66. data/lib/git/commands/config_option_syntax.rb +56 -0
  67. data/lib/git/commands/describe.rb +156 -0
  68. data/lib/git/commands/diff.rb +657 -0
  69. data/lib/git/commands/diff_files.rb +519 -0
  70. data/lib/git/commands/diff_index.rb +499 -0
  71. data/lib/git/commands/fetch.rb +354 -0
  72. data/lib/git/commands/fsck.rb +138 -0
  73. data/lib/git/commands/gc.rb +134 -0
  74. data/lib/git/commands/grep.rb +339 -0
  75. data/lib/git/commands/init.rb +101 -0
  76. data/lib/git/commands/log.rb +634 -0
  77. data/lib/git/commands/ls_files.rb +195 -0
  78. data/lib/git/commands/ls_remote.rb +161 -0
  79. data/lib/git/commands/ls_tree.rb +135 -0
  80. data/lib/git/commands/maintenance/register.rb +73 -0
  81. data/lib/git/commands/maintenance/run.rb +105 -0
  82. data/lib/git/commands/maintenance/start.rb +67 -0
  83. data/lib/git/commands/maintenance/stop.rb +56 -0
  84. data/lib/git/commands/maintenance/unregister.rb +80 -0
  85. data/lib/git/commands/maintenance.rb +29 -0
  86. data/lib/git/commands/merge/abort.rb +44 -0
  87. data/lib/git/commands/merge/continue.rb +44 -0
  88. data/lib/git/commands/merge/quit.rb +46 -0
  89. data/lib/git/commands/merge/start.rb +250 -0
  90. data/lib/git/commands/merge.rb +28 -0
  91. data/lib/git/commands/merge_base.rb +91 -0
  92. data/lib/git/commands/mv.rb +82 -0
  93. data/lib/git/commands/name_rev.rb +119 -0
  94. data/lib/git/commands/pull.rb +382 -0
  95. data/lib/git/commands/push.rb +251 -0
  96. data/lib/git/commands/read_tree.rb +154 -0
  97. data/lib/git/commands/remote/add.rb +96 -0
  98. data/lib/git/commands/remote/get_url.rb +68 -0
  99. data/lib/git/commands/remote/list.rb +56 -0
  100. data/lib/git/commands/remote/prune.rb +63 -0
  101. data/lib/git/commands/remote/remove.rb +52 -0
  102. data/lib/git/commands/remote/rename.rb +76 -0
  103. data/lib/git/commands/remote/set_branches.rb +70 -0
  104. data/lib/git/commands/remote/set_head.rb +89 -0
  105. data/lib/git/commands/remote/set_url.rb +78 -0
  106. data/lib/git/commands/remote/set_url_add.rb +70 -0
  107. data/lib/git/commands/remote/set_url_delete.rb +71 -0
  108. data/lib/git/commands/remote/show.rb +77 -0
  109. data/lib/git/commands/remote/update.rb +79 -0
  110. data/lib/git/commands/remote.rb +42 -0
  111. data/lib/git/commands/repack.rb +281 -0
  112. data/lib/git/commands/reset.rb +154 -0
  113. data/lib/git/commands/rev_parse.rb +304 -0
  114. data/lib/git/commands/revert/abort.rb +45 -0
  115. data/lib/git/commands/revert/continue.rb +62 -0
  116. data/lib/git/commands/revert/quit.rb +47 -0
  117. data/lib/git/commands/revert/skip.rb +44 -0
  118. data/lib/git/commands/revert/start.rb +158 -0
  119. data/lib/git/commands/revert.rb +29 -0
  120. data/lib/git/commands/rm.rb +113 -0
  121. data/lib/git/commands/show.rb +632 -0
  122. data/lib/git/commands/show_ref/exclude_existing.rb +119 -0
  123. data/lib/git/commands/show_ref/exists.rb +75 -0
  124. data/lib/git/commands/show_ref/list.rb +149 -0
  125. data/lib/git/commands/show_ref/verify.rb +122 -0
  126. data/lib/git/commands/show_ref.rb +42 -0
  127. data/lib/git/commands/stash/apply.rb +81 -0
  128. data/lib/git/commands/stash/branch.rb +67 -0
  129. data/lib/git/commands/stash/clear.rb +43 -0
  130. data/lib/git/commands/stash/create.rb +60 -0
  131. data/lib/git/commands/stash/drop.rb +73 -0
  132. data/lib/git/commands/stash/list.rb +43 -0
  133. data/lib/git/commands/stash/pop.rb +87 -0
  134. data/lib/git/commands/stash/push.rb +112 -0
  135. data/lib/git/commands/stash/show.rb +158 -0
  136. data/lib/git/commands/stash/store.rb +72 -0
  137. data/lib/git/commands/stash.rb +38 -0
  138. data/lib/git/commands/status.rb +174 -0
  139. data/lib/git/commands/symbolic_ref/delete.rb +72 -0
  140. data/lib/git/commands/symbolic_ref/read.rb +99 -0
  141. data/lib/git/commands/symbolic_ref/update.rb +79 -0
  142. data/lib/git/commands/symbolic_ref.rb +38 -0
  143. data/lib/git/commands/tag/create.rb +142 -0
  144. data/lib/git/commands/tag/delete.rb +57 -0
  145. data/lib/git/commands/tag/list.rb +146 -0
  146. data/lib/git/commands/tag/verify.rb +71 -0
  147. data/lib/git/commands/tag.rb +26 -0
  148. data/lib/git/commands/update_ref/batch.rb +145 -0
  149. data/lib/git/commands/update_ref/delete.rb +90 -0
  150. data/lib/git/commands/update_ref/update.rb +103 -0
  151. data/lib/git/commands/update_ref.rb +42 -0
  152. data/lib/git/commands/version.rb +60 -0
  153. data/lib/git/commands/worktree/add.rb +139 -0
  154. data/lib/git/commands/worktree/list.rb +64 -0
  155. data/lib/git/commands/worktree/lock.rb +58 -0
  156. data/lib/git/commands/worktree/management_base.rb +51 -0
  157. data/lib/git/commands/worktree/move.rb +66 -0
  158. data/lib/git/commands/worktree/prune.rb +67 -0
  159. data/lib/git/commands/worktree/remove.rb +63 -0
  160. data/lib/git/commands/worktree/repair.rb +71 -0
  161. data/lib/git/commands/worktree/unlock.rb +47 -0
  162. data/lib/git/commands/worktree.rb +43 -0
  163. data/lib/git/commands/write_tree.rb +68 -0
  164. data/lib/git/commands.rb +88 -0
  165. data/lib/git/config.rb +64 -1
  166. data/lib/git/config_entry_info.rb +106 -0
  167. data/lib/git/configuring.rb +795 -0
  168. data/lib/git/detached_head_info.rb +57 -0
  169. data/lib/git/diff.rb +295 -12
  170. data/lib/git/diff_file_numstat_info.rb +31 -0
  171. data/lib/git/diff_file_patch_info.rb +136 -0
  172. data/lib/git/diff_file_raw_info.rb +129 -0
  173. data/lib/git/diff_info.rb +162 -0
  174. data/lib/git/diff_path_status.rb +80 -19
  175. data/lib/git/diff_result.rb +34 -0
  176. data/lib/git/diff_stats.rb +66 -14
  177. data/lib/git/dirstat_info.rb +102 -0
  178. data/lib/git/encoding_utils.rb +57 -1
  179. data/lib/git/errors.rb +107 -26
  180. data/lib/git/escaped_path.rb +55 -3
  181. data/lib/git/execution_context/global.rb +31 -0
  182. data/lib/git/execution_context/repository.rb +151 -0
  183. data/lib/git/execution_context.rb +559 -0
  184. data/lib/git/factories.rb +1049 -0
  185. data/lib/git/file_ref.rb +77 -0
  186. data/lib/git/fsck_object.rb +17 -9
  187. data/lib/git/fsck_result.rb +27 -16
  188. data/lib/git/log.rb +172 -65
  189. data/lib/git/object.rb +323 -108
  190. data/lib/git/parsers/branch.rb +240 -0
  191. data/lib/git/parsers/cat_file.rb +111 -0
  192. data/lib/git/parsers/config_entry.rb +110 -0
  193. data/lib/git/parsers/diff.rb +792 -0
  194. data/lib/git/parsers/fsck.rb +144 -0
  195. data/lib/git/parsers/grep.rb +42 -0
  196. data/lib/git/parsers/ls_remote.rb +79 -0
  197. data/lib/git/parsers/ls_tree.rb +58 -0
  198. data/lib/git/parsers/remote.rb +162 -0
  199. data/lib/git/parsers/stash.rb +292 -0
  200. data/lib/git/parsers/status.rb +251 -0
  201. data/lib/git/parsers/tag.rb +341 -0
  202. data/lib/git/parsers/worktree.rb +185 -0
  203. data/lib/git/path_resolver.rb +274 -0
  204. data/lib/git/remote_info.rb +203 -0
  205. data/lib/git/repository/branching.rb +796 -0
  206. data/lib/git/repository/committing.rb +221 -0
  207. data/lib/git/repository/context_helpers.rb +454 -0
  208. data/lib/git/repository/diffing.rb +743 -0
  209. data/lib/git/repository/inspecting.rb +252 -0
  210. data/lib/git/repository/logging.rb +410 -0
  211. data/lib/git/repository/maintenance.rb +65 -0
  212. data/lib/git/repository/merging.rb +429 -0
  213. data/lib/git/repository/object_operations.rb +1334 -0
  214. data/lib/git/repository/remote_operations.rb +772 -0
  215. data/lib/git/repository/shared_private.rb +120 -0
  216. data/lib/git/repository/staging.rb +409 -0
  217. data/lib/git/repository/stashing.rb +619 -0
  218. data/lib/git/repository/status_operations.rb +196 -0
  219. data/lib/git/repository/worktree_operations.rb +252 -0
  220. data/lib/git/repository.rb +204 -1
  221. data/lib/git/stash_info.rb +102 -0
  222. data/lib/git/status_file_info.rb +258 -0
  223. data/lib/git/status_info.rb +189 -0
  224. data/lib/git/system_call_guard.rb +95 -0
  225. data/lib/git/tag_delete_failure.rb +34 -0
  226. data/lib/git/tag_delete_result.rb +66 -0
  227. data/lib/git/tag_info.rb +99 -0
  228. data/lib/git/url.rb +12 -5
  229. data/lib/git/version.rb +111 -2
  230. data/lib/git/version_constraint.rb +85 -0
  231. data/lib/git/worktree_info.rb +128 -0
  232. data/lib/git.rb +319 -332
  233. metadata +318 -74
  234. data/.commitlintrc.yml +0 -38
  235. data/.github/copilot-instructions.md +0 -2733
  236. data/.github/issue_template.md +0 -15
  237. data/.github/pull_request_template.md +0 -17
  238. data/.github/workflows/continuous_integration.yml +0 -120
  239. data/.github/workflows/enforce_conventional_commits.yml +0 -29
  240. data/.github/workflows/experimental_continuous_integration.yml +0 -59
  241. data/.github/workflows/release.yml +0 -53
  242. data/.gitignore +0 -15
  243. data/.husky/commit-msg +0 -1
  244. data/.release-please-manifest.json +0 -3
  245. data/.rubocop.yml +0 -55
  246. data/.rubocop_todo.yml +0 -12
  247. data/Gemfile +0 -5
  248. data/Rakefile +0 -18
  249. data/lib/git/args_builder.rb +0 -111
  250. data/lib/git/author.rb +0 -16
  251. data/lib/git/base.rb +0 -1140
  252. data/lib/git/branch.rb +0 -423
  253. data/lib/git/branches.rb +0 -68
  254. data/lib/git/command_line_result.rb +0 -92
  255. data/lib/git/index.rb +0 -6
  256. data/lib/git/lib.rb +0 -2333
  257. data/lib/git/path.rb +0 -38
  258. data/lib/git/remote.rb +0 -39
  259. data/lib/git/stash.rb +0 -26
  260. data/lib/git/stashes.rb +0 -56
  261. data/lib/git/status.rb +0 -159
  262. data/lib/git/working_directory.rb +0 -6
  263. data/lib/git/worktree.rb +0 -39
  264. data/lib/git/worktrees.rb +0 -47
  265. data/package.json +0 -10
  266. data/redesign/1_architecture_existing.md +0 -66
  267. data/redesign/2_architecture_redesign.md +0 -130
  268. data/redesign/3_architecture_implementation.md +0 -138
  269. data/redesign/index.md +0 -34
  270. data/release-please-config.json +0 -36
  271. data/tasks/gem_tasks.rake +0 -10
  272. data/tasks/rubocop.rake +0 -12
  273. data/tasks/test.rake +0 -13
  274. data/tasks/test_gem.rake +0 -12
  275. data/tasks/yard.rake +0 -23
@@ -0,0 +1,772 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'git/commands/fetch'
4
+ require 'git/commands/ls_remote'
5
+ require 'git/commands/pull'
6
+ require 'git/commands/push'
7
+ require 'git/commands/remote'
8
+ require 'git/parsers/ls_remote'
9
+ require 'git/parsers/remote'
10
+
11
+ require 'git/repository/shared_private'
12
+
13
+ module Git
14
+ class Repository
15
+ # Mixin that adds remote operation facade methods to {Git::Repository}
16
+ #
17
+ # Included by {Git::Repository}.
18
+ #
19
+ # @api private
20
+ #
21
+ module RemoteOperations
22
+ # Key normalizations for {#fetch} options
23
+ #
24
+ # Maps dash-style option keys (which the 4.x `Git::Lib#fetch` accepted)
25
+ # to their canonical underscore-style equivalents.
26
+ #
27
+ # @return [Hash{Symbol => Symbol}]
28
+ #
29
+ # @api private
30
+ #
31
+ FETCH_KEY_NORMALIZATIONS = { 'update-head-ok': :update_head_ok, 'prune-tags': :prune_tags }.freeze
32
+ private_constant :FETCH_KEY_NORMALIZATIONS
33
+
34
+ # Option keys accepted by {#fetch}
35
+ #
36
+ # Derived from the 4.x `FETCH_OPTION_MAP` in `Git::Lib`.
37
+ #
38
+ # @return [Array<Symbol>]
39
+ #
40
+ # @api private
41
+ #
42
+ FETCH_ALLOWED_OPTS = %i[all tags t prune p prune_tags P force f update_head_ok u unshallow depth ref].freeze
43
+ private_constant :FETCH_ALLOWED_OPTS
44
+
45
+ # Download objects and refs from a remote repository
46
+ #
47
+ # Fetches branches and/or tags from one or more other repositories, along
48
+ # with the objects necessary to complete their histories. The local
49
+ # tracking references are updated but the working directory is not
50
+ # modified.
51
+ #
52
+ # @example Fetch from the default remote
53
+ # repo.fetch
54
+ #
55
+ # @example Fetch from a named remote
56
+ # repo.fetch('upstream')
57
+ #
58
+ # @example Fetch all remotes at once
59
+ # repo.fetch(all: true)
60
+ #
61
+ # @example Fetch and prune deleted remote branches
62
+ # repo.fetch('origin', prune: true)
63
+ #
64
+ # @example Fetch a specific refspec
65
+ # repo.fetch('origin', ref: 'refs/heads/main:refs/remotes/origin/main')
66
+ #
67
+ # @example Fetch multiple refspecs
68
+ # repo.fetch('origin', ref: ['refs/heads/main', 'refs/heads/develop'])
69
+ #
70
+ # @example Fetch and include all tags
71
+ # repo.fetch('origin', tags: true)
72
+ #
73
+ # @param remote [String, Hash, nil] the remote name or URL to fetch from
74
+ #
75
+ # When a Hash is given it is treated as `opts` and `remote` defaults to
76
+ # `nil` (which omits the remote positional argument and lets git use the
77
+ # configured default).
78
+ #
79
+ # @param opts [Hash] options for the fetch command
80
+ #
81
+ # @option opts [Boolean, nil] :all (nil) fetch from all configured remotes
82
+ # (`--all`)
83
+ #
84
+ # @option opts [Boolean, nil] :tags (nil) fetch all tags from the remote
85
+ # (`--tags`)
86
+ #
87
+ # Alias: `:t`
88
+ #
89
+ # @option opts [Boolean, nil] :prune (nil) remove remote-tracking references
90
+ # that no longer exist on the remote (`--prune`)
91
+ #
92
+ # Alias: `:p`
93
+ #
94
+ # @option opts [Boolean, nil] :prune_tags (nil) remove local tags that no
95
+ # longer exist on the remote (`--prune-tags`)
96
+ #
97
+ # Alias: `:P`. The legacy dash-style key `:'prune-tags'` is also accepted
98
+ # and normalized automatically.
99
+ #
100
+ # @option opts [Boolean, nil] :force (nil) override the fast-forward check
101
+ # when using explicit refspecs (`--force`)
102
+ #
103
+ # Alias: `:f`
104
+ #
105
+ # @option opts [Boolean, nil] :update_head_ok (nil) allow `git fetch` to
106
+ # update the branch pointed to by `HEAD` (`--update-head-ok`)
107
+ #
108
+ # Alias: `:u`. The legacy dash-style key `:'update-head-ok'` is also
109
+ # accepted and normalized automatically.
110
+ #
111
+ # @option opts [Boolean, nil] :unshallow (nil) convert a shallow clone into a
112
+ # full repository (`--unshallow`)
113
+ #
114
+ # @option opts [String, Integer] :depth (nil) limit history to N commits from
115
+ # each branch tip (`--depth=N`)
116
+ #
117
+ # @option opts [String, Array<String>] :ref (nil) one or more refspecs to
118
+ # fetch; forwarded as positional arguments after the remote name. An explicit
119
+ # `remote` is required when `:ref` is given.
120
+ #
121
+ # @return [String] the merged stdout from the fetch command
122
+ #
123
+ # @raise [ArgumentError] when unsupported option keys are provided or `:ref`
124
+ # is supplied without an explicit remote
125
+ #
126
+ # @raise [Git::FailedError] when git exits with a non-zero status
127
+ #
128
+ def fetch(remote = 'origin', opts = {})
129
+ remote, opts = Private.resolve_fetch_target(remote, opts)
130
+
131
+ opts = Private.normalize_fetch_keys(opts)
132
+ SharedPrivate.assert_valid_opts!(FETCH_ALLOWED_OPTS, **opts)
133
+
134
+ opts = opts.dup
135
+ refspecs = Array(opts.delete(:ref)).compact
136
+ positionals = [*([remote] if remote), *refspecs]
137
+
138
+ Git::Commands::Fetch.new(@execution_context).call(*positionals, **opts, merge: true).stdout
139
+ end
140
+
141
+ # Option keys accepted by {#pull}
142
+ #
143
+ # Derived from the 4.x `PULL_OPTION_MAP` in `Git::Lib`.
144
+ #
145
+ # @return [Array<Symbol>]
146
+ #
147
+ # @api private
148
+ #
149
+ PULL_ALLOWED_OPTS = %i[allow_unrelated_histories].freeze
150
+ private_constant :PULL_ALLOWED_OPTS
151
+
152
+ # Incorporate changes from a remote repository into the current branch
153
+ #
154
+ # Fetches from the given remote and merges into the current branch. In its
155
+ # default mode, `git pull` is shorthand for `git fetch` followed by
156
+ # `git merge FETCH_HEAD`. The merge editor is suppressed (`--no-edit`) and
157
+ # progress output is silenced (`--no-progress`) by default.
158
+ #
159
+ # @example Pull from the default remote and branch
160
+ # repo.pull
161
+ #
162
+ # @example Pull from a named remote
163
+ # repo.pull('upstream')
164
+ #
165
+ # @example Pull a specific branch from a remote
166
+ # repo.pull('origin', 'main')
167
+ #
168
+ # @example Pull allowing unrelated histories
169
+ # repo.pull('origin', 'main', allow_unrelated_histories: true)
170
+ #
171
+ # @param remote [String, nil] the remote name or URL to pull from
172
+ #
173
+ # When nil, git uses the tracking remote for the current branch.
174
+ #
175
+ # @param branch [String, nil] the remote branch name to pull
176
+ #
177
+ # When nil, git uses the tracking branch for the current branch.
178
+ # A branch may not be specified without also specifying a remote.
179
+ #
180
+ # @param opts [Hash] options for the pull command
181
+ #
182
+ # @option opts [Boolean, nil] :allow_unrelated_histories (nil) allow merging
183
+ # histories that do not share a common ancestor
184
+ # (`--allow-unrelated-histories`)
185
+ #
186
+ # @return [String] the stdout from the pull command
187
+ #
188
+ # @raise [ArgumentError] when a branch is given without a remote, or when
189
+ # unsupported option keys are provided
190
+ #
191
+ # @raise [Git::FailedError] when git exits with a non-zero status
192
+ #
193
+ # @note The fetch completes before the merge starts, so a failure after the
194
+ # fetch leaves `FETCH_HEAD` and any updated remote-tracking branches in
195
+ # place. On a conflict, the merge is left in progress as described at
196
+ # {#merge}, or the rebase when the repository is configured to pull with
197
+ # rebase.
198
+ #
199
+ def pull(remote = nil, branch = nil, opts = {})
200
+ raise ArgumentError, 'You must specify a remote if a branch is specified' if remote.nil? && !branch.nil?
201
+
202
+ SharedPrivate.assert_valid_opts!(PULL_ALLOWED_OPTS, **opts)
203
+ positional_args = [remote, branch].compact
204
+ Git::Commands::Pull
205
+ .new(@execution_context)
206
+ .call(*positional_args, no_edit: true, no_progress: true, **opts)
207
+ .stdout
208
+ end
209
+
210
+ # Option keys accepted by {#push}
211
+ #
212
+ # Derived from the 4.x `PUSH_OPTION_MAP` in `Git::Lib`.
213
+ #
214
+ # @return [Array<Symbol>]
215
+ #
216
+ # @api private
217
+ #
218
+ PUSH_ALLOWED_OPTS = %i[mirror delete force f push_option all tags].freeze
219
+ private_constant :PUSH_ALLOWED_OPTS
220
+
221
+ # Push refs to a remote repository
222
+ #
223
+ # @example Push using the current branch's default remote and push configuration
224
+ # repo.push
225
+ #
226
+ # @example Push to a named remote
227
+ # repo.push('origin')
228
+ #
229
+ # @example Force-push the current branch to a named remote
230
+ # repo.push('origin', force: true)
231
+ #
232
+ # @example Push a specific branch to a named remote
233
+ # repo.push('origin', 'main')
234
+ #
235
+ # @example Push a branch and all tags to a named remote
236
+ # repo.push('origin', 'main', tags: true)
237
+ #
238
+ # @example Push all branches to a named remote
239
+ # repo.push('origin', all: true)
240
+ #
241
+ # @example Mirror all refs to a named remote
242
+ # repo.push('origin', mirror: true)
243
+ #
244
+ # @param remote [String, Hash, nil] the remote name or URL to push to
245
+ #
246
+ # When a Hash is given it is treated as `opts` and `remote` defaults to
247
+ # `nil` so git uses the configured default push target.
248
+ #
249
+ # @param branch [String, Hash, nil] the branch name or refspec to push
250
+ #
251
+ # When a Hash is given it is treated as `opts` and `branch` defaults to
252
+ # `nil`. A branch may not be specified without also specifying a remote.
253
+ #
254
+ # @param opts [Hash, Boolean, nil] options for the push command
255
+ #
256
+ # For backward compatibility, a Boolean is interpreted as
257
+ # `tags: <Boolean>`.
258
+ #
259
+ # @option opts [Boolean, nil] :all (nil) push all branches (`--all`)
260
+ #
261
+ # @option opts [Boolean, nil] :mirror (nil) push all refs under `refs/` to
262
+ # the remote (`--mirror`)
263
+ #
264
+ # @option opts [Boolean, nil] :tags (nil) push all refs under `refs/tags/`
265
+ # in a second `git push` invocation (`--tags`)
266
+ #
267
+ # When `:mirror` is also given, the tags push is suppressed because
268
+ # `--mirror` already includes tags.
269
+ #
270
+ # @option opts [Boolean, nil] :force (nil) force updates, overriding the
271
+ # fast-forward check (`--force`)
272
+ #
273
+ # Alias: `:f`
274
+ #
275
+ # @option opts [Boolean, nil] :delete (nil) delete the named refs from the
276
+ # remote (`--delete`)
277
+ #
278
+ # @option opts [String, Array<String>] :push_option (nil) one or more
279
+ # server-side push option values (`--push-option=<value>`, repeatable)
280
+ #
281
+ # @return [String] the stdout from the push command
282
+ #
283
+ # @raise [ArgumentError] when `branch` is given without `remote`
284
+ #
285
+ # @raise [ArgumentError] when unsupported option keys are provided
286
+ #
287
+ # @raise [Git::FailedError] when git exits with a non-zero exit status
288
+ #
289
+ def push(remote = nil, branch = nil, opts = nil)
290
+ remote, branch, opts = Private.normalize_push_args(remote, branch, opts)
291
+ SharedPrivate.assert_valid_opts!(PUSH_ALLOWED_OPTS, **opts)
292
+ raise ArgumentError, 'remote is required if branch is specified' if !remote && branch
293
+
294
+ first_result = Private.push_refs(@execution_context, remote, branch, opts)
295
+ return first_result.stdout unless Private.push_tags_separately?(opts)
296
+
297
+ Private.push_tags(@execution_context, remote, opts).stdout
298
+ end
299
+
300
+ # Option keys accepted by {#remote_add}
301
+ #
302
+ # Derived from the 4.x `REMOTE_ADD_OPTION_MAP` in `Git::Lib`.
303
+ REMOTE_ADD_ALLOWED_OPTS = %i[fetch track].freeze
304
+ private_constant :REMOTE_ADD_ALLOWED_OPTS
305
+
306
+ # Register a new remote in the local repository
307
+ #
308
+ # Associates `name` with `url` and optionally fetches immediately or
309
+ # configures which branches are tracked.
310
+ #
311
+ # @example Add a remote
312
+ # repo.remote_add('upstream', 'https://github.com/user/repo.git')
313
+ #
314
+ # @example Add a remote and fetch immediately
315
+ # repo.remote_add('upstream', 'https://github.com/user/repo.git', fetch: true)
316
+ #
317
+ # @example Add a remote tracking a specific branch
318
+ # repo.remote_add('upstream', 'https://github.com/user/repo.git', track: 'main')
319
+ #
320
+ # @param name [String] the name for the new remote
321
+ #
322
+ # @param url [String, Git::Repository] the URL of the remote repository
323
+ #
324
+ # A {Git::Repository} instance is accepted for local references and converted
325
+ # to `url.repo.to_s`.
326
+ #
327
+ # @param opts [Hash] options for adding the remote
328
+ #
329
+ # @option opts [Boolean, nil] :fetch (nil) fetch from the remote immediately
330
+ # after adding it (`-f`)
331
+ #
332
+ # The deprecated alias `:with_fetch` is accepted and normalized
333
+ # automatically.
334
+ #
335
+ # @option opts [String, nil] :track (nil) track only the given branch during
336
+ # fetch (`-t`)
337
+ #
338
+ # @return [void]
339
+ #
340
+ # @raise [ArgumentError] when unsupported option keys are provided
341
+ #
342
+ # @raise [Git::FailedError] if git exits with a non-zero exit status
343
+ #
344
+ def remote_add(name, url, opts = {})
345
+ url = url.repo.to_s if url.is_a?(Git::Repository)
346
+ opts = Private.normalize_add_remote_keys(opts)
347
+ SharedPrivate.assert_valid_opts!(REMOTE_ADD_ALLOWED_OPTS, **opts)
348
+ Git::Commands::Remote::Add.new(@execution_context).call(name, url, **opts)
349
+
350
+ nil
351
+ end
352
+
353
+ # Removes a remote from this repository
354
+ #
355
+ # Deletes the remote named `name` along with its associated configuration,
356
+ # tracking references, and remote-tracking branches.
357
+ #
358
+ # @example Remove a remote named 'upstream'
359
+ # repo.remote_remove('upstream')
360
+ #
361
+ # @param name [String] the name of the remote to remove
362
+ #
363
+ # @return [Git::CommandLine::Result] the result of calling `git remote remove`
364
+ #
365
+ # @raise [Git::FailedError] when git exits with a non-zero status
366
+ #
367
+ def remote_remove(name)
368
+ Git::Commands::Remote::Remove.new(@execution_context).call(name)
369
+ end
370
+
371
+ # Sets the URL for an existing remote
372
+ #
373
+ # Replaces the fetch URL configured for the remote named `name`.
374
+ #
375
+ # @example Set the URL for a remote
376
+ # repo.remote_set_url('origin', 'https://github.com/user/repo.git')
377
+ #
378
+ # @example Set the URL from a local repository reference
379
+ # source = Git.open('/path/to/source')
380
+ # repo.remote_set_url('origin', source)
381
+ #
382
+ # @param name [String] the name of the remote to update
383
+ #
384
+ # @param url [String, Git::Repository] the new URL for the remote
385
+ #
386
+ # A {Git::Repository} instance is accepted for local references and converted
387
+ # to `url.repo.to_s`.
388
+ #
389
+ # @return [void]
390
+ #
391
+ # @raise [Git::FailedError] if git exits with a non-zero exit status
392
+ #
393
+ def remote_set_url(name, url)
394
+ url = url.repo.to_s if url.is_a?(Git::Repository)
395
+ Git::Commands::Remote::SetUrl.new(@execution_context).call(name, url)
396
+
397
+ nil
398
+ end
399
+
400
+ # Configures which branches are fetched for a remote
401
+ #
402
+ # Uses `git remote set-branches` to set or append fetch refspecs. When the
403
+ # `add:` option is `false`, the `--add` flag is not passed to the git
404
+ # command and the tracked branch list is replaced.
405
+ #
406
+ # @example Replace fetched branches with a single glob pattern
407
+ # repo.remote_set_branches('origin', 'feature/*')
408
+ #
409
+ # @example Append a glob pattern to existing fetched branches
410
+ # repo.remote_set_branches('origin', 'release/*', add: true)
411
+ #
412
+ # @example Configure multiple explicit branches
413
+ # repo.remote_set_branches('origin', 'main', 'development', 'hotfix')
414
+ #
415
+ # @param name [String] the remote name (for example, `"origin"`)
416
+ #
417
+ # @param branches [Array<String>] branch names or globs (for example, `'*'`)
418
+ #
419
+ # @param add [Boolean] when `true`, append to existing refspecs instead of
420
+ # replacing them
421
+ #
422
+ # @return [void]
423
+ #
424
+ # @raise [ArgumentError] when no branches are provided
425
+ #
426
+ # @raise [Git::FailedError] when git exits with a non-zero status
427
+ #
428
+ def remote_set_branches(name, *branches, add: false)
429
+ branch_list = branches.flatten
430
+ raise ArgumentError, 'branches are required' if branch_list.empty?
431
+
432
+ Git::Commands::Remote::SetBranches.new(@execution_context).call(name, *branch_list, add: add)
433
+
434
+ nil
435
+ end
436
+
437
+ # List all configured remotes as {Git::RemoteInfo} objects
438
+ #
439
+ # Reads the repository configuration via {Git::Configuring#config_list} and
440
+ # returns one {Git::RemoteInfo} per configured remote, preserving the order
441
+ # in which remotes appear in the config. Multi-value fields (`:url`,
442
+ # `:push_url`, `:fetch`, `:push`) are always `Array<String>` (never `nil`).
443
+ #
444
+ # @example List all remotes
445
+ # repo.remote_list
446
+ # # => [#<data Git::RemoteInfo name="origin" ...>,
447
+ # # #<data Git::RemoteInfo name="upstream" ...>]
448
+ #
449
+ # @example Get fetch URLs for all remotes
450
+ # repo.remote_list.map { |r| [r.name, r.url] }.to_h
451
+ #
452
+ # @return [Array<Git::RemoteInfo>] one entry per configured remote
453
+ #
454
+ # Returns an empty array when no remotes are configured.
455
+ #
456
+ # @raise [ArgumentError] if a `remote.*` config entry carries an
457
+ # unrecognized boolean value (e.g. `remote.origin.prune=maybe`)
458
+ #
459
+ # @raise [Git::FailedError] if git exits with a non-zero exit status
460
+ #
461
+ def remote_list
462
+ Git::Parsers::Remote.parse_list(config_list)
463
+ end
464
+
465
+ # Returns the names of all configured remotes
466
+ #
467
+ # Lists remote names by running `git remote`. This is a lightweight
468
+ # alternative to {#remote_list} when only names are needed — in
469
+ # particular, it returns the raw name (e.g. `"team/upstream"`) preserving
470
+ # any slashes in the remote name.
471
+ #
472
+ # @example Get all remote names
473
+ # repo.remote_names #=> ["origin", "upstream"]
474
+ #
475
+ # @example With a slash-containing remote name
476
+ # repo.remote_names #=> ["origin", "team/upstream"]
477
+ #
478
+ # @return [Array<String>] the configured remote names
479
+ #
480
+ # Returns an empty array when no remotes are configured.
481
+ #
482
+ # @raise [Git::FailedError] if git exits with a non-zero exit status
483
+ #
484
+ # @api public
485
+ #
486
+ def remote_names
487
+ Git::Commands::Remote::List.new(@execution_context).call.stdout.split("\n")
488
+ end
489
+
490
+ # Option keys accepted by {#ls_remote}
491
+ #
492
+ # @return [Array<Symbol>]
493
+ #
494
+ # @api private
495
+ #
496
+ LS_REMOTE_ALLOWED_OPTS = %i[
497
+ branches b heads h tags t refs upload_pack quiet q exit_code sort server_option o timeout
498
+ ].freeze
499
+ private_constant :LS_REMOTE_ALLOWED_OPTS
500
+
501
+ # List references available in a remote repository
502
+ #
503
+ # Queries a remote for its available refs and returns a structured Hash
504
+ # mapping ref types to name/sha pairs. The remote is contacted but no local
505
+ # objects are created or updated.
506
+ #
507
+ # @example List all refs from the local repository
508
+ # repo.ls_remote
509
+ # # => {"head"=>{ref: "HEAD", sha: "abc123"},
510
+ # # "branches"=>{"main"=>{ref: "refs/heads/main", sha: "abc123"}}}
511
+ #
512
+ # @example List all refs from a named remote
513
+ # repo.ls_remote('origin')
514
+ # # => {"head"=>..., "branches"=>..., "tags"=>...}
515
+ #
516
+ # @example List only tags from a named remote
517
+ # repo.ls_remote('origin', tags: true)
518
+ # # => {"tags"=>{"v1.0"=>{ref: "refs/tags/v1.0", sha: "def456"}}}
519
+ #
520
+ # @param location [String, nil] the remote name or URL to query; defaults to
521
+ # `'.'` (the local repository) when nil
522
+ #
523
+ # @param opts [Hash] options for the ls-remote command
524
+ #
525
+ # @option opts [Boolean, nil] :branches (nil) limit output to refs under
526
+ # `refs/heads/`; alias: `:b`
527
+ #
528
+ # @option opts [Boolean, nil] :heads (nil) limit output to refs under
529
+ # `refs/heads/`; kept for backward compatibility; alias: `:h`
530
+ #
531
+ # @option opts [Boolean, nil] :tags (nil) limit output to refs under
532
+ # `refs/tags/`; alias: `:t`
533
+ #
534
+ # @option opts [Boolean, nil] :refs (nil) exclude peeled tags and pseudorefs
535
+ # like `HEAD` from the output
536
+ #
537
+ # @option opts [Numeric] :timeout (nil) execution timeout in seconds
538
+ #
539
+ # @return [Hash{String => Hash}] a Hash keyed by ref type (e.g. `"head"`,
540
+ # `"branches"`, `"tags"`; other git namespace segments may appear for
541
+ # non-standard refs); for named refs the value is a Hash keyed by ref name
542
+ # mapping to `{ ref: String, sha: String }`; for the `"head"` entry the value
543
+ # is `{ ref: String, sha: String }` directly
544
+ #
545
+ # @raise [ArgumentError] if unsupported options are provided
546
+ #
547
+ # @raise [Git::FailedError] if git exits outside the allowed range (exit code > 2)
548
+ #
549
+ def ls_remote(location = nil, opts = {})
550
+ SharedPrivate.assert_valid_opts!(LS_REMOTE_ALLOWED_OPTS, **opts)
551
+ repository = location || '.'
552
+ output_lines = Git::Commands::LsRemote.new(@execution_context).call(repository, **opts).stdout.split("\n")
553
+ Git::Parsers::LsRemote.parse_output(output_lines)
554
+ end
555
+
556
+ # Helpers private to the `RemoteOperations` topic module
557
+ #
558
+ # @api private
559
+ #
560
+ module Private
561
+ module_function
562
+
563
+ # Resolve the (remote, opts) pair for {#fetch}, supporting the hash-only form
564
+ #
565
+ # `fetch` may be called as `fetch(remote, opts)` or `fetch(opts)`. When a bare
566
+ # options hash is passed the remote is treated as nil. A `:ref` is only
567
+ # meaningful with an explicit remote, so requesting one without a remote (it
568
+ # would otherwise be silently promoted to the remote-name slot) is rejected.
569
+ #
570
+ # @param remote [String, Hash, nil] the remote name, or an options hash
571
+ #
572
+ # @param opts [Hash] the options hash when remote is given positionally
573
+ #
574
+ # @option opts [String, Array<String>, nil] :ref (nil) one or more refspecs
575
+ # forwarded after the remote name
576
+ #
577
+ # Requires an explicit `remote`.
578
+ #
579
+ # @return [Array(String, Hash), Array(nil, Hash)] the resolved remote and opts
580
+ #
581
+ # @raise [ArgumentError] when :ref is supplied without an explicit remote
582
+ #
583
+ # @api private
584
+ #
585
+ def resolve_fetch_target(remote, opts)
586
+ if remote.is_a?(Hash)
587
+ opts = remote
588
+ remote = nil
589
+ end
590
+
591
+ raise ArgumentError, ':ref requires an explicit remote' if remote.nil? && opts.key?(:ref)
592
+
593
+ [remote, opts]
594
+ end
595
+
596
+ # Normalize dash-style option keys to their underscore equivalents
597
+ #
598
+ # Converts any key in {FETCH_KEY_NORMALIZATIONS} from its dash-style symbol
599
+ # form (e.g., `:'update-head-ok'`) to the canonical underscore-style form
600
+ # (e.g., `:update_head_ok`). Unrecognized keys are returned unchanged.
601
+ #
602
+ # @param opts [Hash] the raw options hash passed by the caller
603
+ #
604
+ # @option opts [Object] :'prune-tags' a legacy dash-style fetch option value
605
+ #
606
+ # @option opts [Object] :'update-head-ok' a legacy dash-style fetch option
607
+ # value
608
+ #
609
+ # @return [Hash] a new hash with all applicable keys normalized
610
+ #
611
+ # @api private
612
+ #
613
+ def normalize_fetch_keys(opts)
614
+ opts.transform_keys do |k|
615
+ sym = k.is_a?(Symbol) ? k : k.to_sym
616
+ FETCH_KEY_NORMALIZATIONS.fetch(sym, sym)
617
+ end
618
+ end
619
+
620
+ # Normalize the flexible argument list accepted by {RemoteOperations#push}
621
+ #
622
+ # Handles three call forms:
623
+ # - `push(opts)` — Hash promoted from `remote` position
624
+ # - `push(remote, opts)` — Hash promoted from `branch` position
625
+ # - `push(remote, branch, true|false)` — Boolean `opts` converted to
626
+ # `{ tags: opts }` for backward compatibility
627
+ #
628
+ # @param remote [String, Hash, nil] remote name, URL, or opts hash
629
+ #
630
+ # @param branch [String, Hash, nil] branch/refspec, or opts hash
631
+ #
632
+ # @param opts [Hash, Boolean, nil] options hash or legacy Boolean shorthand
633
+ #
634
+ # @option opts [Boolean, nil] :all (nil) push all branches
635
+ #
636
+ # @option opts [Boolean, nil] :mirror (nil) mirror all refs
637
+ #
638
+ # @option opts [Boolean, nil] :tags (nil) push all tags
639
+ #
640
+ # @option opts [Boolean, nil] :delete (nil) delete refs on the remote
641
+ #
642
+ # @option opts [Boolean, nil] :force (nil) force updates
643
+ #
644
+ # @option opts [String, Array<String>] :push_option (nil) one or more
645
+ # push-option values
646
+ #
647
+ # @return [Array((String, nil), (String, nil), Hash)] normalized [remote, branch, opts]
648
+ #
649
+ # @api private
650
+ #
651
+ def normalize_push_args(remote, branch, opts)
652
+ if branch.is_a?(Hash)
653
+ opts = branch
654
+ branch = nil
655
+ elsif remote.is_a?(Hash)
656
+ opts = remote
657
+ remote = nil
658
+ end
659
+
660
+ opts ||= {}
661
+
662
+ # Backwards compatibility for `push(remote, branch, true)` to push tags
663
+ # without requiring the caller to use keyword arguments
664
+
665
+ opts = { tags: opts } if [true, false].include?(opts)
666
+ [remote, branch, opts]
667
+ end
668
+
669
+ # Issue the refs push (first push when `:tags` is given separately)
670
+ #
671
+ # Strips `:tags` from the options so that only refs — not tags — are pushed
672
+ # in this first call. Tags are pushed in a separate call when
673
+ # {push_tags_separately?} is true.
674
+ #
675
+ # @param execution_context [Git::ExecutionContext::Repository] the repository execution context
676
+ #
677
+ # @param remote [String, nil] remote name or URL
678
+ #
679
+ # @param branch [String, nil] branch or refspec
680
+ #
681
+ # @param opts [Hash] push options (`:tags` key will be stripped)
682
+ #
683
+ # @option opts [Boolean, nil] :all (nil) push all branches
684
+ #
685
+ # @option opts [Boolean, nil] :mirror (nil) mirror all refs
686
+ #
687
+ # @option opts [Boolean, nil] :delete (nil) delete refs on the remote
688
+ #
689
+ # @option opts [Boolean, nil] :force (nil) force updates
690
+ #
691
+ # @option opts [String, Array<String>] :push_option (nil) one or more
692
+ # push-option values
693
+ #
694
+ # @return [Git::CommandLine::Result]
695
+ #
696
+ # @api private
697
+ #
698
+ def push_refs(execution_context, remote, branch, opts)
699
+ positionals = [remote, branch].compact
700
+ Git::Commands::Push.new(execution_context).call(*positionals, **opts.except(:tags))
701
+ end
702
+
703
+ # Return true when tags must be pushed in a second separate invocation
704
+ #
705
+ # Tags are pushed separately when `:tags` is truthy AND `:mirror` is not set.
706
+ # When `:mirror` is set, the mirror push already includes all refs and tags,
707
+ # so a second tags-only call would be redundant.
708
+ #
709
+ # @param opts [Hash] the normalized push options
710
+ #
711
+ # @option opts [Boolean, nil] :tags (nil) request a separate tags push
712
+ #
713
+ # @option opts [Boolean, nil] :mirror (nil) indicates refs are mirrored and
714
+ # tags are already covered
715
+ #
716
+ # @return [Boolean]
717
+ #
718
+ # @api private
719
+ #
720
+ def push_tags_separately?(opts)
721
+ opts[:tags] && !opts[:mirror]
722
+ end
723
+
724
+ # Issue the tags push (second push when `:tags` is requested without `:mirror`)
725
+ #
726
+ # @param execution_context [Git::ExecutionContext::Repository] the repository execution context
727
+ #
728
+ # @param remote [String, nil] remote name or URL
729
+ #
730
+ # @param opts [Hash] push options (`:tags` key included to emit `--tags`)
731
+ #
732
+ # @option opts [Boolean, nil] :tags (nil) emit `--tags`
733
+ #
734
+ # @option opts [String, Array<String>] :push_option (nil) one or more
735
+ # push-option values
736
+ #
737
+ # @return [Git::CommandLine::Result]
738
+ #
739
+ # @api private
740
+ #
741
+ def push_tags(execution_context, remote, opts)
742
+ Git::Commands::Push.new(execution_context).call(*[remote].compact, **opts)
743
+ end
744
+
745
+ # Normalize deprecated option keys for {#remote_add} to their canonical equivalents
746
+ #
747
+ # Renames the deprecated `:with_fetch` key to `:fetch`, removing it from
748
+ # the copy. When both keys are present, `:with_fetch` takes precedence.
749
+ #
750
+ # @param opts [Hash] the raw options hash passed by the caller
751
+ #
752
+ # @option opts [Boolean, nil] :with_fetch (nil) deprecated alias for
753
+ # immediate fetch behavior
754
+ #
755
+ # @option opts [Boolean, nil] :fetch (nil) fetch from the remote after adding
756
+ #
757
+ # @option opts [String, nil] :track (nil) track the given branch during fetch
758
+ #
759
+ # @return [Hash] a new hash with all applicable keys normalized
760
+ #
761
+ # @api private
762
+ #
763
+ def normalize_add_remote_keys(opts)
764
+ normalized = opts.dup
765
+ normalized[:fetch] = normalized.delete(:with_fetch) if normalized.key?(:with_fetch)
766
+ normalized
767
+ end
768
+ end
769
+ private_constant :Private
770
+ end
771
+ end
772
+ end