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
@@ -0,0 +1,106 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Git
4
+ # Represents a single Git configuration entry
5
+ #
6
+ # Returned by {Git::Configuring} read operations such as {Git::Configuring#config_get},
7
+ # {Git::Configuring#config_get_all}, {Git::Configuring#config_list}, and their
8
+ # related methods.
9
+ #
10
+ # @example Create a ConfigEntryInfo
11
+ # entry = Git::ConfigEntryInfo.new(
12
+ # scope: 'local',
13
+ # origin: 'file:.git/config',
14
+ # key: 'remote.origin.url',
15
+ # value: 'https://github.com/ruby-git/ruby-git'
16
+ # )
17
+ # entry.section # => "remote"
18
+ # entry.subsection # => "origin"
19
+ # entry.variable # => "url"
20
+ #
21
+ # @api public
22
+ #
23
+ # @!attribute [r] scope
24
+ #
25
+ # The scope of the configuration entry
26
+ #
27
+ # May be one of `"system"`, `"global"`, `"local"`, `"worktree"`, `"command"`,
28
+ # `"file"`, or `"blob"`. The `"command"` scope is used for values supplied
29
+ # via the command line (including default values from `--default`).
30
+ #
31
+ # @return [String] the config scope string (e.g. `"local"`, `"global"`)
32
+ #
33
+ # @!attribute [r] origin
34
+ #
35
+ # Where the configuration entry originates
36
+ #
37
+ # The origin is in the format `<origin-type>:<actual-origin>` and is never
38
+ # blank. The origin type prefix is one of `file:`, `blob:`, `command line:`,
39
+ # or `standard input:`.
40
+ #
41
+ # `nil` when the git command used to retrieve this entry does not support
42
+ # `--show-origin` (currently only `--get-urlmatch`).
43
+ #
44
+ # @return [String, nil] the origin path in the format `<type>:<path>`, or `nil`
45
+ #
46
+ # @!attribute [r] key
47
+ #
48
+ # The full dotted key name of the configuration entry (e.g., `remote.origin.url`)
49
+ #
50
+ # @return [String] the full dotted key name (e.g. `remote.origin.url`)
51
+ #
52
+ # @!attribute [r] value
53
+ #
54
+ # The value of the configuration entry
55
+ #
56
+ # @return [String] the string value of this entry
57
+ #
58
+ ConfigEntryInfo = Data.define(:scope, :origin, :key, :value) do
59
+ # Returns the section component of the key (everything before the first dot)
60
+ #
61
+ # Returns an empty string when the key contains no dot.
62
+ #
63
+ # @example Section component of a dotted key
64
+ # entry.section # => "remote"
65
+ #
66
+ # @return [String] the section name, or an empty string when the key has no dot
67
+ #
68
+ def section = first_dot ? key[0...first_dot] : ''
69
+
70
+ # Returns the subsection component of the key (everything between the first and last dot)
71
+ #
72
+ # Returns an empty string when the key has zero or one dot (no subsection).
73
+ #
74
+ # @example Subsection component of a dotted key
75
+ # entry.subsection # => "origin"
76
+ #
77
+ # @return [String] the subsection name, or an empty string when there is no subsection
78
+ #
79
+ def subsection = first_dot && first_dot != last_dot ? key[(first_dot + 1)...last_dot] : ''
80
+
81
+ # Returns the variable component of the key (everything after the last dot)
82
+ #
83
+ # Returns the full key when the key contains no dot.
84
+ #
85
+ # @example Variable component of a dotted key
86
+ # entry.variable # => "url"
87
+ #
88
+ # @return [String] the variable name (everything after the last dot)
89
+ #
90
+ def variable = last_dot ? key[(last_dot + 1)..] : key
91
+
92
+ private
93
+
94
+ # Returns the index of the first dot in the key, or nil if none exists
95
+ #
96
+ # @return [Integer, nil] the zero-based index of the first dot, or `nil`
97
+ #
98
+ def first_dot = key.index('.')
99
+
100
+ # Returns the index of the last dot in the key, or nil if none exists
101
+ #
102
+ # @return [Integer, nil] the zero-based index of the last dot, or `nil`
103
+ #
104
+ def last_dot = key.rindex('.')
105
+ end
106
+ end