git 5.0.0.beta.1 → 5.0.0.beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/copilot-instructions.md +6 -0
- data/.github/prompts/iteratively-address-copilot-reviews.prompt.md +188 -0
- data/.github/skills/extract-facade-from-base-lib/KEYWORD_ARG_REMEDIATION.md +22 -0
- data/.github/skills/extract-facade-from-base-lib/SKILL.md +28 -14
- data/.github/skills/facade-implementation/SKILL.md +14 -0
- data/.github/skills/facade-test-conventions/SKILL.md +14 -0
- data/.rubocop.yml +5 -0
- data/README.md +90 -22
- data/UPGRADING.md +141 -0
- data/git.gemspec +5 -0
- data/lib/git/branch.rb +7 -18
- data/lib/git/branches.rb +2 -10
- data/lib/git/command_line/base.rb +10 -0
- data/lib/git/command_line/capturing.rb +5 -3
- data/lib/git/command_line/streaming.rb +5 -3
- data/lib/git/command_line.rb +3 -3
- data/lib/git/commands/base.rb +7 -6
- data/lib/git/commands/cat_file/batch.rb +6 -1
- data/lib/git/commands/cat_file/raw.rb +7 -1
- data/lib/git/commands/config_option_syntax/get_urlmatch.rb +5 -0
- data/lib/git/commands/show_ref/exclude_existing.rb +1 -1
- data/lib/git/commands/update_ref/batch.rb +1 -1
- data/lib/git/commands/version.rb +5 -0
- data/lib/git/commands.rb +5 -7
- data/lib/git/config.rb +17 -0
- data/lib/git/config_entry_info.rb +106 -0
- data/lib/git/configuring.rb +665 -0
- data/lib/git/deprecation.rb +9 -0
- data/lib/git/diff.rb +4 -8
- data/lib/git/diff_path_status.rb +2 -13
- data/lib/git/diff_stats.rb +1 -9
- data/lib/git/execution_context/global.rb +3 -28
- data/lib/git/execution_context/repository.rb +30 -41
- data/lib/git/execution_context.rb +43 -24
- data/lib/git/log.rb +3 -9
- data/lib/git/object.rb +14 -21
- data/lib/git/parsers/config_entry.rb +110 -0
- data/lib/git/parsers/ls_remote.rb +79 -0
- data/lib/git/remote.rb +7 -20
- data/lib/git/repository/branching.rb +183 -12
- data/lib/git/repository/committing.rb +64 -68
- data/lib/git/repository/context_helpers.rb +264 -0
- data/lib/git/repository/factories.rb +682 -0
- data/lib/git/repository/inspecting.rb +99 -0
- data/lib/git/repository/maintenance.rb +65 -0
- data/lib/git/repository/merging.rb +63 -1
- data/lib/git/repository/object_operations.rb +133 -35
- data/lib/git/repository/path_resolver.rb +1 -1
- data/lib/git/repository/remote_operations.rb +166 -21
- data/lib/git/repository/staging.rb +187 -23
- data/lib/git/repository/stashing.rb +39 -3
- data/lib/git/repository/status_operations.rb +21 -0
- data/lib/git/repository.rb +288 -128
- data/lib/git/stash.rb +2 -9
- data/lib/git/stashes.rb +2 -7
- data/lib/git/status.rb +12 -23
- data/lib/git/version.rb +2 -2
- data/lib/git/worktree.rb +2 -15
- data/lib/git/worktrees.rb +2 -15
- data/lib/git.rb +182 -77
- data/redesign/3_architecture_implementation.md +170 -112
- data/redesign/Phase 4 - Step A.md +366 -0
- data/redesign/beta_release.md +107 -0
- data/redesign/c1c2_audit.md +566 -0
- data/redesign/c1c2_bucket6_lib_orphans.md +626 -0
- data/redesign/config_design.rb +501 -0
- metadata +19 -6
- data/lib/git/base.rb +0 -1204
- data/lib/git/lib.rb +0 -2855
- data/lib/git/repository/configuring.rb +0 -156
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'git/commands/config_option_syntax'
|
|
4
|
-
require 'git/repository/shared_private'
|
|
5
|
-
|
|
6
|
-
module Git
|
|
7
|
-
class Repository
|
|
8
|
-
# Facade methods for reading and writing git configuration
|
|
9
|
-
#
|
|
10
|
-
# Provides the {#config} method, which dispatches to read a single entry,
|
|
11
|
-
# list all entries, or write a value depending on the arguments supplied.
|
|
12
|
-
#
|
|
13
|
-
# Included by {Git::Repository}.
|
|
14
|
-
#
|
|
15
|
-
# @api public
|
|
16
|
-
#
|
|
17
|
-
module Configuring
|
|
18
|
-
# Option keys accepted by {#config} when writing a value
|
|
19
|
-
CONFIG_SET_ALLOWED_OPTS = %i[file].freeze
|
|
20
|
-
private_constant :CONFIG_SET_ALLOWED_OPTS
|
|
21
|
-
|
|
22
|
-
# Read or write a git configuration entry
|
|
23
|
-
#
|
|
24
|
-
# Dispatches to one of three modes depending on the arguments supplied:
|
|
25
|
-
#
|
|
26
|
-
# * **List** — `config()` returns all visible config entries as a `Hash`.
|
|
27
|
-
# * **Get** — `config(name)` returns the value for a single key as a `String`.
|
|
28
|
-
# * **Set** — `config(name, value)` writes a value and returns the raw
|
|
29
|
-
# command result.
|
|
30
|
-
#
|
|
31
|
-
# @overload config
|
|
32
|
-
#
|
|
33
|
-
# @example List all config entries
|
|
34
|
-
# repo.config #=> { "user.name" => "Alice", "core.bare" => "false" }
|
|
35
|
-
#
|
|
36
|
-
# @return [Hash{String => String}] all visible config entries, keyed by
|
|
37
|
-
# their full dotted key names (e.g. `"user.name"`)
|
|
38
|
-
#
|
|
39
|
-
# @overload config(name)
|
|
40
|
-
#
|
|
41
|
-
# @example Read the committer name from config
|
|
42
|
-
# repo.config('user.name') #=> "Alice"
|
|
43
|
-
#
|
|
44
|
-
# @param name [String] the dotted config key to look up (e.g.
|
|
45
|
-
# `"user.name"`)
|
|
46
|
-
#
|
|
47
|
-
# @return [String] the value of the config entry
|
|
48
|
-
#
|
|
49
|
-
# @overload config(name, value, options = {})
|
|
50
|
-
#
|
|
51
|
-
# @example Set the committer name in local config
|
|
52
|
-
# repo.config('user.name', 'Alice')
|
|
53
|
-
#
|
|
54
|
-
# @example Write a value to a custom config file
|
|
55
|
-
# repo.config('user.name', 'Alice', file: '/path/to/custom/config')
|
|
56
|
-
#
|
|
57
|
-
# @param name [String] the dotted config key to write (e.g.
|
|
58
|
-
# `"user.name"`)
|
|
59
|
-
#
|
|
60
|
-
# @param value [String] the value to assign
|
|
61
|
-
#
|
|
62
|
-
# @param options [Hash] options for the set operation
|
|
63
|
-
#
|
|
64
|
-
# @option options [String, nil] :file (nil) path to a custom config file
|
|
65
|
-
# to write to instead of the repository's default `.git/config`
|
|
66
|
-
#
|
|
67
|
-
# @return [Git::CommandLineResult] the raw result of
|
|
68
|
-
# `git config <name> <value>`
|
|
69
|
-
#
|
|
70
|
-
# @raise [ArgumentError] if unsupported options are provided
|
|
71
|
-
#
|
|
72
|
-
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
73
|
-
#
|
|
74
|
-
def config(name = nil, value = nil, options = {})
|
|
75
|
-
if name && value
|
|
76
|
-
Private.config_set(@execution_context, name, value, **options)
|
|
77
|
-
elsif name
|
|
78
|
-
Private.config_get(@execution_context, name)
|
|
79
|
-
else
|
|
80
|
-
Private.config_list(@execution_context)
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
# Private helpers local to {Git::Repository::Configuring}
|
|
85
|
-
#
|
|
86
|
-
# @api private
|
|
87
|
-
#
|
|
88
|
-
module Private
|
|
89
|
-
module_function
|
|
90
|
-
|
|
91
|
-
# Set a config value by key name
|
|
92
|
-
#
|
|
93
|
-
# @overload config_set(execution_context, name, value, **options)
|
|
94
|
-
#
|
|
95
|
-
# @param execution_context [Git::ExecutionContext] the execution context
|
|
96
|
-
#
|
|
97
|
-
# @param name [String] the dotted config key to write (e.g. `"user.name"`)
|
|
98
|
-
#
|
|
99
|
-
# @param value [String] the value to assign
|
|
100
|
-
#
|
|
101
|
-
# @param options [Hash] keyword options forwarded to the command
|
|
102
|
-
#
|
|
103
|
-
# @option options [String, nil] :file (nil) path to a custom config file
|
|
104
|
-
# to write to instead of the repository's default `.git/config`
|
|
105
|
-
#
|
|
106
|
-
# @return [Git::CommandLineResult] the raw result of
|
|
107
|
-
# `git config <name> <value>`
|
|
108
|
-
#
|
|
109
|
-
# @raise [ArgumentError] if unsupported options are provided
|
|
110
|
-
#
|
|
111
|
-
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
112
|
-
#
|
|
113
|
-
def config_set(execution_context, name, value, **)
|
|
114
|
-
SharedPrivate.assert_valid_opts!(CONFIG_SET_ALLOWED_OPTS, **)
|
|
115
|
-
Git::Commands::ConfigOptionSyntax::Set.new(execution_context).call(name, value, **)
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
# Retrieve a config value by key name
|
|
119
|
-
#
|
|
120
|
-
# @param execution_context [Git::ExecutionContext] the execution context
|
|
121
|
-
#
|
|
122
|
-
# @param name [String] the dotted config key to look up (e.g. `"user.name"`)
|
|
123
|
-
#
|
|
124
|
-
# @return [String] the value of the config entry
|
|
125
|
-
#
|
|
126
|
-
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
127
|
-
#
|
|
128
|
-
def config_get(execution_context, name)
|
|
129
|
-
result = Git::Commands::ConfigOptionSyntax::Get.new(execution_context).call(name)
|
|
130
|
-
raise Git::FailedError, result if result.status.exitstatus != 0
|
|
131
|
-
|
|
132
|
-
result.stdout
|
|
133
|
-
end
|
|
134
|
-
|
|
135
|
-
# Retrieve all config entries as a hash
|
|
136
|
-
#
|
|
137
|
-
# @param execution_context [Git::ExecutionContext] the execution context
|
|
138
|
-
#
|
|
139
|
-
# @return [Hash{String => String}] all config entries, keyed by their full
|
|
140
|
-
# dotted key names (e.g. `"user.name"`)
|
|
141
|
-
#
|
|
142
|
-
# @raise [Git::FailedError] if git exits with a non-zero exit status
|
|
143
|
-
#
|
|
144
|
-
def config_list(execution_context)
|
|
145
|
-
lines = Git::Commands::ConfigOptionSyntax::List.new(execution_context).call.stdout.split("\n")
|
|
146
|
-
lines.each_with_object({}) do |line, hsh|
|
|
147
|
-
key, value = line.split('=', 2)
|
|
148
|
-
hsh[key] = value || ''
|
|
149
|
-
end
|
|
150
|
-
end
|
|
151
|
-
end
|
|
152
|
-
|
|
153
|
-
private_constant :Private
|
|
154
|
-
end
|
|
155
|
-
end
|
|
156
|
-
end
|