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.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/.github/copilot-instructions.md +6 -0
  3. data/.github/prompts/iteratively-address-copilot-reviews.prompt.md +188 -0
  4. data/.github/skills/extract-facade-from-base-lib/KEYWORD_ARG_REMEDIATION.md +22 -0
  5. data/.github/skills/extract-facade-from-base-lib/SKILL.md +28 -14
  6. data/.github/skills/facade-implementation/SKILL.md +14 -0
  7. data/.github/skills/facade-test-conventions/SKILL.md +14 -0
  8. data/.rubocop.yml +5 -0
  9. data/README.md +90 -22
  10. data/UPGRADING.md +141 -0
  11. data/git.gemspec +5 -0
  12. data/lib/git/branch.rb +7 -18
  13. data/lib/git/branches.rb +2 -10
  14. data/lib/git/command_line/base.rb +10 -0
  15. data/lib/git/command_line/capturing.rb +5 -3
  16. data/lib/git/command_line/streaming.rb +5 -3
  17. data/lib/git/command_line.rb +3 -3
  18. data/lib/git/commands/base.rb +7 -6
  19. data/lib/git/commands/cat_file/batch.rb +6 -1
  20. data/lib/git/commands/cat_file/raw.rb +7 -1
  21. data/lib/git/commands/config_option_syntax/get_urlmatch.rb +5 -0
  22. data/lib/git/commands/show_ref/exclude_existing.rb +1 -1
  23. data/lib/git/commands/update_ref/batch.rb +1 -1
  24. data/lib/git/commands/version.rb +5 -0
  25. data/lib/git/commands.rb +5 -7
  26. data/lib/git/config.rb +17 -0
  27. data/lib/git/config_entry_info.rb +106 -0
  28. data/lib/git/configuring.rb +665 -0
  29. data/lib/git/deprecation.rb +9 -0
  30. data/lib/git/diff.rb +4 -8
  31. data/lib/git/diff_path_status.rb +2 -13
  32. data/lib/git/diff_stats.rb +1 -9
  33. data/lib/git/execution_context/global.rb +3 -28
  34. data/lib/git/execution_context/repository.rb +30 -41
  35. data/lib/git/execution_context.rb +43 -24
  36. data/lib/git/log.rb +3 -9
  37. data/lib/git/object.rb +14 -21
  38. data/lib/git/parsers/config_entry.rb +110 -0
  39. data/lib/git/parsers/ls_remote.rb +79 -0
  40. data/lib/git/remote.rb +7 -20
  41. data/lib/git/repository/branching.rb +183 -12
  42. data/lib/git/repository/committing.rb +64 -68
  43. data/lib/git/repository/context_helpers.rb +264 -0
  44. data/lib/git/repository/factories.rb +682 -0
  45. data/lib/git/repository/inspecting.rb +99 -0
  46. data/lib/git/repository/maintenance.rb +65 -0
  47. data/lib/git/repository/merging.rb +63 -1
  48. data/lib/git/repository/object_operations.rb +133 -35
  49. data/lib/git/repository/path_resolver.rb +1 -1
  50. data/lib/git/repository/remote_operations.rb +166 -21
  51. data/lib/git/repository/staging.rb +187 -23
  52. data/lib/git/repository/stashing.rb +39 -3
  53. data/lib/git/repository/status_operations.rb +21 -0
  54. data/lib/git/repository.rb +288 -128
  55. data/lib/git/stash.rb +2 -9
  56. data/lib/git/stashes.rb +2 -7
  57. data/lib/git/status.rb +12 -23
  58. data/lib/git/version.rb +2 -2
  59. data/lib/git/worktree.rb +2 -15
  60. data/lib/git/worktrees.rb +2 -15
  61. data/lib/git.rb +182 -77
  62. data/redesign/3_architecture_implementation.md +170 -112
  63. data/redesign/Phase 4 - Step A.md +366 -0
  64. data/redesign/beta_release.md +107 -0
  65. data/redesign/c1c2_audit.md +566 -0
  66. data/redesign/c1c2_bucket6_lib_orphans.md +626 -0
  67. data/redesign/config_design.rb +501 -0
  68. metadata +19 -6
  69. data/lib/git/base.rb +0 -1204
  70. data/lib/git/lib.rb +0 -2855
  71. 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