Class: Git::RemoteInfo

Inherits:
Data
  • Object
show all
Defined in:
lib/git/remote_info.rb

Overview

Value object representing a configured git remote

Each instance holds the parsed configuration for a single remote as read from the repository's git config. Multi-value fields (:url, :push_url, :fetch, :push) are always Array<String> (never nil; may be empty). Those arrays are frozen copies of the values given, so the set of URLs and refspecs cannot change after construction; use with to derive a modified copy. The immutability is shallow, as with any Data member: the strings inside those arrays and the scalar members are the objects the caller passed in, not copies. All other fields are nilable except :name.

Examples:

Minimal remote (fetch-only, one URL)

info = Git::RemoteInfo.new(
  name: 'origin',
  url: ['https://github.com/ruby-git/ruby-git.git'],
  push_url: [],
  fetch: ['+refs/heads/*:refs/remotes/origin/*'],
  push: []
)
info.name   # => "origin"
info.url    # => ["https://github.com/ruby-git/ruby-git.git"]
info.prune  # => nil

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, url: [], push_url: [], fetch: [], push: [], mirror: nil, skip_default_update: nil, tag_opt: nil, prune: nil, prune_tags: nil, receivepack: nil, uploadpack: nil, promisor: nil, partial_clone_filter: nil, vcs: nil) ⇒ Git::RemoteInfo

Create a new RemoteInfo

Parameters:

  • name (String)

    the name of the remote (required)

  • url (Array<String>) (defaults to: [])

    fetch URLs (default []); stored as a frozen copy

  • push_url (Array<String>) (defaults to: [])

    push URLs (default []); stored as a frozen copy

  • fetch (Array<String>) (defaults to: [])

    fetch refspecs (default []); stored as a frozen copy

  • push (Array<String>) (defaults to: [])

    push refspecs (default []); stored as a frozen copy

  • mirror (Boolean, nil) (defaults to: nil)

    mirror flag (default nil)

  • skip_default_update (Boolean, nil) (defaults to: nil)

    skip-default-update flag (default nil)

  • tag_opt (String, nil) (defaults to: nil)

    tag-fetching option (default nil)

  • prune (Boolean, nil) (defaults to: nil)

    prune flag (default nil)

  • prune_tags (Boolean, nil) (defaults to: nil)

    prune-tags flag (default nil)

  • receivepack (String, nil) (defaults to: nil)

    receive-pack path (default nil)

  • uploadpack (String, nil) (defaults to: nil)

    upload-pack path (default nil)

  • promisor (Boolean, nil) (defaults to: nil)

    promisor flag (default nil)

  • partial_clone_filter (String, nil) (defaults to: nil)

    partial-clone filter (default nil)

  • vcs (String, nil) (defaults to: nil)

    VCS type (default nil)



125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/git/remote_info.rb', line 125

def initialize( # rubocop:disable Metrics/ParameterLists
  name:,
  url: [],
  push_url: [],
  fetch: [],
  push: [],
  mirror: nil,
  skip_default_update: nil,
  tag_opt: nil,
  prune: nil,
  prune_tags: nil,
  receivepack: nil,
  uploadpack: nil,
  promisor: nil,
  partial_clone_filter: nil,
  vcs: nil
)
  super(
    name:, url: Array(url).dup.freeze, push_url: Array(push_url).dup.freeze,
    fetch: Array(fetch).dup.freeze, push: Array(push).dup.freeze, mirror:,
    skip_default_update:, tag_opt:, prune:, prune_tags:, receivepack:, uploadpack:,
    promisor:, partial_clone_filter:, vcs:
  )
end

Instance Attribute Details

#fetchArray<String> (readonly)

Returns the fetch refspec(s) for this remote (remote.<name>.fetch).

Returns:

  • (Array<String>)

    the fetch refspec(s) for this remote (remote.<name>.fetch)



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/git/remote_info.rb', line 74

RemoteInfo = Data.define(
  :name,
  :url,
  :push_url,
  :fetch,
  :push,
  :mirror,
  :skip_default_update,
  :tag_opt,
  :prune,
  :prune_tags,
  :receivepack,
  :uploadpack,
  :promisor,
  :partial_clone_filter,
  :vcs
) do
  # Create a new RemoteInfo
  #
  # @param name [String] the name of the remote (required)
  #
  # @param url [Array<String>] fetch URLs (default `[]`); stored as a frozen copy
  #
  # @param push_url [Array<String>] push URLs (default `[]`); stored as a frozen copy
  #
  # @param fetch [Array<String>] fetch refspecs (default `[]`); stored as a frozen copy
  #
  # @param push [Array<String>] push refspecs (default `[]`); stored as a frozen copy
  #
  # @param mirror [Boolean, nil] mirror flag (default `nil`)
  #
  # @param skip_default_update [Boolean, nil] skip-default-update flag (default `nil`)
  #
  # @param tag_opt [String, nil] tag-fetching option (default `nil`)
  #
  # @param prune [Boolean, nil] prune flag (default `nil`)
  #
  # @param prune_tags [Boolean, nil] prune-tags flag (default `nil`)
  #
  # @param receivepack [String, nil] receive-pack path (default `nil`)
  #
  # @param uploadpack [String, nil] upload-pack path (default `nil`)
  #
  # @param promisor [Boolean, nil] promisor flag (default `nil`)
  #
  # @param partial_clone_filter [String, nil] partial-clone filter (default `nil`)
  #
  # @param vcs [String, nil] VCS type (default `nil`)
  #
  # @return [Git::RemoteInfo]
  #
  def initialize( # rubocop:disable Metrics/ParameterLists
    name:,
    url: [],
    push_url: [],
    fetch: [],
    push: [],
    mirror: nil,
    skip_default_update: nil,
    tag_opt: nil,
    prune: nil,
    prune_tags: nil,
    receivepack: nil,
    uploadpack: nil,
    promisor: nil,
    partial_clone_filter: nil,
    vcs: nil
  )
    super(
      name:, url: Array(url).dup.freeze, push_url: Array(push_url).dup.freeze,
      fetch: Array(fetch).dup.freeze, push: Array(push).dup.freeze, mirror:,
      skip_default_update:, tag_opt:, prune:, prune_tags:, receivepack:, uploadpack:,
      promisor:, partial_clone_filter:, vcs:
    )
  end

  # Return a copy of this RemoteInfo with the given fields replaced
  #
  # Routes through {#initialize} so the multi-value fields of the copy are
  # frozen copies, the same as on construction. `Data#with` bypasses
  # `initialize` on Ruby 3.2, which would leave those arrays mutable.
  #
  # @example Replace the fetch URL
  #   info.with(url: ['https://example.com/other.git']).url
  #   # => ["https://example.com/other.git"]
  #
  # @param fields [Hash{Symbol => Object}] the fields to replace, keyed by
  #   member name
  #
  # @option fields [String] :name the name of the remote
  #
  # @option fields [Array<String>] :url fetch URLs
  #
  # @option fields [Array<String>] :push_url push URLs
  #
  # @option fields [Array<String>] :fetch fetch refspecs
  #
  # @option fields [Array<String>] :push push refspecs
  #
  # @option fields [Boolean, nil] :mirror mirror flag
  #
  # @option fields [Boolean, nil] :skip_default_update skip-default-update flag
  #
  # @option fields [String, nil] :tag_opt tag-fetching option
  #
  # @option fields [Boolean, nil] :prune prune flag
  #
  # @option fields [Boolean, nil] :prune_tags prune-tags flag
  #
  # @option fields [String, nil] :receivepack receive-pack path
  #
  # @option fields [String, nil] :uploadpack upload-pack path
  #
  # @option fields [Boolean, nil] :promisor promisor flag
  #
  # @option fields [String, nil] :partial_clone_filter partial-clone filter
  #
  # @option fields [String, nil] :vcs VCS type
  #
  # @return [Git::RemoteInfo] a new instance; `self` when no fields are given
  #
  # @raise [ArgumentError] if a key is not a member of this Data class
  #
  def with(**fields)
    return self if fields.empty?

    self.class.new(**to_h, **fields)
  end
end

#mirrorBoolean? (readonly)

Returns true/false per remote.<name>.mirror, or nil when not set.

Returns:

  • (Boolean, nil)

    true/false per remote.<name>.mirror, or nil when not set



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/git/remote_info.rb', line 74

RemoteInfo = Data.define(
  :name,
  :url,
  :push_url,
  :fetch,
  :push,
  :mirror,
  :skip_default_update,
  :tag_opt,
  :prune,
  :prune_tags,
  :receivepack,
  :uploadpack,
  :promisor,
  :partial_clone_filter,
  :vcs
) do
  # Create a new RemoteInfo
  #
  # @param name [String] the name of the remote (required)
  #
  # @param url [Array<String>] fetch URLs (default `[]`); stored as a frozen copy
  #
  # @param push_url [Array<String>] push URLs (default `[]`); stored as a frozen copy
  #
  # @param fetch [Array<String>] fetch refspecs (default `[]`); stored as a frozen copy
  #
  # @param push [Array<String>] push refspecs (default `[]`); stored as a frozen copy
  #
  # @param mirror [Boolean, nil] mirror flag (default `nil`)
  #
  # @param skip_default_update [Boolean, nil] skip-default-update flag (default `nil`)
  #
  # @param tag_opt [String, nil] tag-fetching option (default `nil`)
  #
  # @param prune [Boolean, nil] prune flag (default `nil`)
  #
  # @param prune_tags [Boolean, nil] prune-tags flag (default `nil`)
  #
  # @param receivepack [String, nil] receive-pack path (default `nil`)
  #
  # @param uploadpack [String, nil] upload-pack path (default `nil`)
  #
  # @param promisor [Boolean, nil] promisor flag (default `nil`)
  #
  # @param partial_clone_filter [String, nil] partial-clone filter (default `nil`)
  #
  # @param vcs [String, nil] VCS type (default `nil`)
  #
  # @return [Git::RemoteInfo]
  #
  def initialize( # rubocop:disable Metrics/ParameterLists
    name:,
    url: [],
    push_url: [],
    fetch: [],
    push: [],
    mirror: nil,
    skip_default_update: nil,
    tag_opt: nil,
    prune: nil,
    prune_tags: nil,
    receivepack: nil,
    uploadpack: nil,
    promisor: nil,
    partial_clone_filter: nil,
    vcs: nil
  )
    super(
      name:, url: Array(url).dup.freeze, push_url: Array(push_url).dup.freeze,
      fetch: Array(fetch).dup.freeze, push: Array(push).dup.freeze, mirror:,
      skip_default_update:, tag_opt:, prune:, prune_tags:, receivepack:, uploadpack:,
      promisor:, partial_clone_filter:, vcs:
    )
  end

  # Return a copy of this RemoteInfo with the given fields replaced
  #
  # Routes through {#initialize} so the multi-value fields of the copy are
  # frozen copies, the same as on construction. `Data#with` bypasses
  # `initialize` on Ruby 3.2, which would leave those arrays mutable.
  #
  # @example Replace the fetch URL
  #   info.with(url: ['https://example.com/other.git']).url
  #   # => ["https://example.com/other.git"]
  #
  # @param fields [Hash{Symbol => Object}] the fields to replace, keyed by
  #   member name
  #
  # @option fields [String] :name the name of the remote
  #
  # @option fields [Array<String>] :url fetch URLs
  #
  # @option fields [Array<String>] :push_url push URLs
  #
  # @option fields [Array<String>] :fetch fetch refspecs
  #
  # @option fields [Array<String>] :push push refspecs
  #
  # @option fields [Boolean, nil] :mirror mirror flag
  #
  # @option fields [Boolean, nil] :skip_default_update skip-default-update flag
  #
  # @option fields [String, nil] :tag_opt tag-fetching option
  #
  # @option fields [Boolean, nil] :prune prune flag
  #
  # @option fields [Boolean, nil] :prune_tags prune-tags flag
  #
  # @option fields [String, nil] :receivepack receive-pack path
  #
  # @option fields [String, nil] :uploadpack upload-pack path
  #
  # @option fields [Boolean, nil] :promisor promisor flag
  #
  # @option fields [String, nil] :partial_clone_filter partial-clone filter
  #
  # @option fields [String, nil] :vcs VCS type
  #
  # @return [Git::RemoteInfo] a new instance; `self` when no fields are given
  #
  # @raise [ArgumentError] if a key is not a member of this Data class
  #
  def with(**fields)
    return self if fields.empty?

    self.class.new(**to_h, **fields)
  end
end

#nameString (readonly)

Returns the name of the remote (e.g. 'origin').

Returns:

  • (String)

    the name of the remote (e.g. 'origin')



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/git/remote_info.rb', line 74

RemoteInfo = Data.define(
  :name,
  :url,
  :push_url,
  :fetch,
  :push,
  :mirror,
  :skip_default_update,
  :tag_opt,
  :prune,
  :prune_tags,
  :receivepack,
  :uploadpack,
  :promisor,
  :partial_clone_filter,
  :vcs
) do
  # Create a new RemoteInfo
  #
  # @param name [String] the name of the remote (required)
  #
  # @param url [Array<String>] fetch URLs (default `[]`); stored as a frozen copy
  #
  # @param push_url [Array<String>] push URLs (default `[]`); stored as a frozen copy
  #
  # @param fetch [Array<String>] fetch refspecs (default `[]`); stored as a frozen copy
  #
  # @param push [Array<String>] push refspecs (default `[]`); stored as a frozen copy
  #
  # @param mirror [Boolean, nil] mirror flag (default `nil`)
  #
  # @param skip_default_update [Boolean, nil] skip-default-update flag (default `nil`)
  #
  # @param tag_opt [String, nil] tag-fetching option (default `nil`)
  #
  # @param prune [Boolean, nil] prune flag (default `nil`)
  #
  # @param prune_tags [Boolean, nil] prune-tags flag (default `nil`)
  #
  # @param receivepack [String, nil] receive-pack path (default `nil`)
  #
  # @param uploadpack [String, nil] upload-pack path (default `nil`)
  #
  # @param promisor [Boolean, nil] promisor flag (default `nil`)
  #
  # @param partial_clone_filter [String, nil] partial-clone filter (default `nil`)
  #
  # @param vcs [String, nil] VCS type (default `nil`)
  #
  # @return [Git::RemoteInfo]
  #
  def initialize( # rubocop:disable Metrics/ParameterLists
    name:,
    url: [],
    push_url: [],
    fetch: [],
    push: [],
    mirror: nil,
    skip_default_update: nil,
    tag_opt: nil,
    prune: nil,
    prune_tags: nil,
    receivepack: nil,
    uploadpack: nil,
    promisor: nil,
    partial_clone_filter: nil,
    vcs: nil
  )
    super(
      name:, url: Array(url).dup.freeze, push_url: Array(push_url).dup.freeze,
      fetch: Array(fetch).dup.freeze, push: Array(push).dup.freeze, mirror:,
      skip_default_update:, tag_opt:, prune:, prune_tags:, receivepack:, uploadpack:,
      promisor:, partial_clone_filter:, vcs:
    )
  end

  # Return a copy of this RemoteInfo with the given fields replaced
  #
  # Routes through {#initialize} so the multi-value fields of the copy are
  # frozen copies, the same as on construction. `Data#with` bypasses
  # `initialize` on Ruby 3.2, which would leave those arrays mutable.
  #
  # @example Replace the fetch URL
  #   info.with(url: ['https://example.com/other.git']).url
  #   # => ["https://example.com/other.git"]
  #
  # @param fields [Hash{Symbol => Object}] the fields to replace, keyed by
  #   member name
  #
  # @option fields [String] :name the name of the remote
  #
  # @option fields [Array<String>] :url fetch URLs
  #
  # @option fields [Array<String>] :push_url push URLs
  #
  # @option fields [Array<String>] :fetch fetch refspecs
  #
  # @option fields [Array<String>] :push push refspecs
  #
  # @option fields [Boolean, nil] :mirror mirror flag
  #
  # @option fields [Boolean, nil] :skip_default_update skip-default-update flag
  #
  # @option fields [String, nil] :tag_opt tag-fetching option
  #
  # @option fields [Boolean, nil] :prune prune flag
  #
  # @option fields [Boolean, nil] :prune_tags prune-tags flag
  #
  # @option fields [String, nil] :receivepack receive-pack path
  #
  # @option fields [String, nil] :uploadpack upload-pack path
  #
  # @option fields [Boolean, nil] :promisor promisor flag
  #
  # @option fields [String, nil] :partial_clone_filter partial-clone filter
  #
  # @option fields [String, nil] :vcs VCS type
  #
  # @return [Git::RemoteInfo] a new instance; `self` when no fields are given
  #
  # @raise [ArgumentError] if a key is not a member of this Data class
  #
  def with(**fields)
    return self if fields.empty?

    self.class.new(**to_h, **fields)
  end
end

#partial_clone_filterString? (readonly)

Returns the partial-clone object filter (remote.<name>.partialclonefilter).

Returns:

  • (String, nil)

    the partial-clone object filter (remote.<name>.partialclonefilter)



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/git/remote_info.rb', line 74

RemoteInfo = Data.define(
  :name,
  :url,
  :push_url,
  :fetch,
  :push,
  :mirror,
  :skip_default_update,
  :tag_opt,
  :prune,
  :prune_tags,
  :receivepack,
  :uploadpack,
  :promisor,
  :partial_clone_filter,
  :vcs
) do
  # Create a new RemoteInfo
  #
  # @param name [String] the name of the remote (required)
  #
  # @param url [Array<String>] fetch URLs (default `[]`); stored as a frozen copy
  #
  # @param push_url [Array<String>] push URLs (default `[]`); stored as a frozen copy
  #
  # @param fetch [Array<String>] fetch refspecs (default `[]`); stored as a frozen copy
  #
  # @param push [Array<String>] push refspecs (default `[]`); stored as a frozen copy
  #
  # @param mirror [Boolean, nil] mirror flag (default `nil`)
  #
  # @param skip_default_update [Boolean, nil] skip-default-update flag (default `nil`)
  #
  # @param tag_opt [String, nil] tag-fetching option (default `nil`)
  #
  # @param prune [Boolean, nil] prune flag (default `nil`)
  #
  # @param prune_tags [Boolean, nil] prune-tags flag (default `nil`)
  #
  # @param receivepack [String, nil] receive-pack path (default `nil`)
  #
  # @param uploadpack [String, nil] upload-pack path (default `nil`)
  #
  # @param promisor [Boolean, nil] promisor flag (default `nil`)
  #
  # @param partial_clone_filter [String, nil] partial-clone filter (default `nil`)
  #
  # @param vcs [String, nil] VCS type (default `nil`)
  #
  # @return [Git::RemoteInfo]
  #
  def initialize( # rubocop:disable Metrics/ParameterLists
    name:,
    url: [],
    push_url: [],
    fetch: [],
    push: [],
    mirror: nil,
    skip_default_update: nil,
    tag_opt: nil,
    prune: nil,
    prune_tags: nil,
    receivepack: nil,
    uploadpack: nil,
    promisor: nil,
    partial_clone_filter: nil,
    vcs: nil
  )
    super(
      name:, url: Array(url).dup.freeze, push_url: Array(push_url).dup.freeze,
      fetch: Array(fetch).dup.freeze, push: Array(push).dup.freeze, mirror:,
      skip_default_update:, tag_opt:, prune:, prune_tags:, receivepack:, uploadpack:,
      promisor:, partial_clone_filter:, vcs:
    )
  end

  # Return a copy of this RemoteInfo with the given fields replaced
  #
  # Routes through {#initialize} so the multi-value fields of the copy are
  # frozen copies, the same as on construction. `Data#with` bypasses
  # `initialize` on Ruby 3.2, which would leave those arrays mutable.
  #
  # @example Replace the fetch URL
  #   info.with(url: ['https://example.com/other.git']).url
  #   # => ["https://example.com/other.git"]
  #
  # @param fields [Hash{Symbol => Object}] the fields to replace, keyed by
  #   member name
  #
  # @option fields [String] :name the name of the remote
  #
  # @option fields [Array<String>] :url fetch URLs
  #
  # @option fields [Array<String>] :push_url push URLs
  #
  # @option fields [Array<String>] :fetch fetch refspecs
  #
  # @option fields [Array<String>] :push push refspecs
  #
  # @option fields [Boolean, nil] :mirror mirror flag
  #
  # @option fields [Boolean, nil] :skip_default_update skip-default-update flag
  #
  # @option fields [String, nil] :tag_opt tag-fetching option
  #
  # @option fields [Boolean, nil] :prune prune flag
  #
  # @option fields [Boolean, nil] :prune_tags prune-tags flag
  #
  # @option fields [String, nil] :receivepack receive-pack path
  #
  # @option fields [String, nil] :uploadpack upload-pack path
  #
  # @option fields [Boolean, nil] :promisor promisor flag
  #
  # @option fields [String, nil] :partial_clone_filter partial-clone filter
  #
  # @option fields [String, nil] :vcs VCS type
  #
  # @return [Git::RemoteInfo] a new instance; `self` when no fields are given
  #
  # @raise [ArgumentError] if a key is not a member of this Data class
  #
  def with(**fields)
    return self if fields.empty?

    self.class.new(**to_h, **fields)
  end
end

#promisorBoolean? (readonly)

Returns true/false per remote.<name>.promisor, or nil when not set.

Returns:

  • (Boolean, nil)

    true/false per remote.<name>.promisor, or nil when not set



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/git/remote_info.rb', line 74

RemoteInfo = Data.define(
  :name,
  :url,
  :push_url,
  :fetch,
  :push,
  :mirror,
  :skip_default_update,
  :tag_opt,
  :prune,
  :prune_tags,
  :receivepack,
  :uploadpack,
  :promisor,
  :partial_clone_filter,
  :vcs
) do
  # Create a new RemoteInfo
  #
  # @param name [String] the name of the remote (required)
  #
  # @param url [Array<String>] fetch URLs (default `[]`); stored as a frozen copy
  #
  # @param push_url [Array<String>] push URLs (default `[]`); stored as a frozen copy
  #
  # @param fetch [Array<String>] fetch refspecs (default `[]`); stored as a frozen copy
  #
  # @param push [Array<String>] push refspecs (default `[]`); stored as a frozen copy
  #
  # @param mirror [Boolean, nil] mirror flag (default `nil`)
  #
  # @param skip_default_update [Boolean, nil] skip-default-update flag (default `nil`)
  #
  # @param tag_opt [String, nil] tag-fetching option (default `nil`)
  #
  # @param prune [Boolean, nil] prune flag (default `nil`)
  #
  # @param prune_tags [Boolean, nil] prune-tags flag (default `nil`)
  #
  # @param receivepack [String, nil] receive-pack path (default `nil`)
  #
  # @param uploadpack [String, nil] upload-pack path (default `nil`)
  #
  # @param promisor [Boolean, nil] promisor flag (default `nil`)
  #
  # @param partial_clone_filter [String, nil] partial-clone filter (default `nil`)
  #
  # @param vcs [String, nil] VCS type (default `nil`)
  #
  # @return [Git::RemoteInfo]
  #
  def initialize( # rubocop:disable Metrics/ParameterLists
    name:,
    url: [],
    push_url: [],
    fetch: [],
    push: [],
    mirror: nil,
    skip_default_update: nil,
    tag_opt: nil,
    prune: nil,
    prune_tags: nil,
    receivepack: nil,
    uploadpack: nil,
    promisor: nil,
    partial_clone_filter: nil,
    vcs: nil
  )
    super(
      name:, url: Array(url).dup.freeze, push_url: Array(push_url).dup.freeze,
      fetch: Array(fetch).dup.freeze, push: Array(push).dup.freeze, mirror:,
      skip_default_update:, tag_opt:, prune:, prune_tags:, receivepack:, uploadpack:,
      promisor:, partial_clone_filter:, vcs:
    )
  end

  # Return a copy of this RemoteInfo with the given fields replaced
  #
  # Routes through {#initialize} so the multi-value fields of the copy are
  # frozen copies, the same as on construction. `Data#with` bypasses
  # `initialize` on Ruby 3.2, which would leave those arrays mutable.
  #
  # @example Replace the fetch URL
  #   info.with(url: ['https://example.com/other.git']).url
  #   # => ["https://example.com/other.git"]
  #
  # @param fields [Hash{Symbol => Object}] the fields to replace, keyed by
  #   member name
  #
  # @option fields [String] :name the name of the remote
  #
  # @option fields [Array<String>] :url fetch URLs
  #
  # @option fields [Array<String>] :push_url push URLs
  #
  # @option fields [Array<String>] :fetch fetch refspecs
  #
  # @option fields [Array<String>] :push push refspecs
  #
  # @option fields [Boolean, nil] :mirror mirror flag
  #
  # @option fields [Boolean, nil] :skip_default_update skip-default-update flag
  #
  # @option fields [String, nil] :tag_opt tag-fetching option
  #
  # @option fields [Boolean, nil] :prune prune flag
  #
  # @option fields [Boolean, nil] :prune_tags prune-tags flag
  #
  # @option fields [String, nil] :receivepack receive-pack path
  #
  # @option fields [String, nil] :uploadpack upload-pack path
  #
  # @option fields [Boolean, nil] :promisor promisor flag
  #
  # @option fields [String, nil] :partial_clone_filter partial-clone filter
  #
  # @option fields [String, nil] :vcs VCS type
  #
  # @return [Git::RemoteInfo] a new instance; `self` when no fields are given
  #
  # @raise [ArgumentError] if a key is not a member of this Data class
  #
  def with(**fields)
    return self if fields.empty?

    self.class.new(**to_h, **fields)
  end
end

#pruneBoolean? (readonly)

Returns true/false per remote.<name>.prune; nil inherits fetch.prune.

Returns:

  • (Boolean, nil)

    true/false per remote.<name>.prune; nil inherits fetch.prune



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/git/remote_info.rb', line 74

RemoteInfo = Data.define(
  :name,
  :url,
  :push_url,
  :fetch,
  :push,
  :mirror,
  :skip_default_update,
  :tag_opt,
  :prune,
  :prune_tags,
  :receivepack,
  :uploadpack,
  :promisor,
  :partial_clone_filter,
  :vcs
) do
  # Create a new RemoteInfo
  #
  # @param name [String] the name of the remote (required)
  #
  # @param url [Array<String>] fetch URLs (default `[]`); stored as a frozen copy
  #
  # @param push_url [Array<String>] push URLs (default `[]`); stored as a frozen copy
  #
  # @param fetch [Array<String>] fetch refspecs (default `[]`); stored as a frozen copy
  #
  # @param push [Array<String>] push refspecs (default `[]`); stored as a frozen copy
  #
  # @param mirror [Boolean, nil] mirror flag (default `nil`)
  #
  # @param skip_default_update [Boolean, nil] skip-default-update flag (default `nil`)
  #
  # @param tag_opt [String, nil] tag-fetching option (default `nil`)
  #
  # @param prune [Boolean, nil] prune flag (default `nil`)
  #
  # @param prune_tags [Boolean, nil] prune-tags flag (default `nil`)
  #
  # @param receivepack [String, nil] receive-pack path (default `nil`)
  #
  # @param uploadpack [String, nil] upload-pack path (default `nil`)
  #
  # @param promisor [Boolean, nil] promisor flag (default `nil`)
  #
  # @param partial_clone_filter [String, nil] partial-clone filter (default `nil`)
  #
  # @param vcs [String, nil] VCS type (default `nil`)
  #
  # @return [Git::RemoteInfo]
  #
  def initialize( # rubocop:disable Metrics/ParameterLists
    name:,
    url: [],
    push_url: [],
    fetch: [],
    push: [],
    mirror: nil,
    skip_default_update: nil,
    tag_opt: nil,
    prune: nil,
    prune_tags: nil,
    receivepack: nil,
    uploadpack: nil,
    promisor: nil,
    partial_clone_filter: nil,
    vcs: nil
  )
    super(
      name:, url: Array(url).dup.freeze, push_url: Array(push_url).dup.freeze,
      fetch: Array(fetch).dup.freeze, push: Array(push).dup.freeze, mirror:,
      skip_default_update:, tag_opt:, prune:, prune_tags:, receivepack:, uploadpack:,
      promisor:, partial_clone_filter:, vcs:
    )
  end

  # Return a copy of this RemoteInfo with the given fields replaced
  #
  # Routes through {#initialize} so the multi-value fields of the copy are
  # frozen copies, the same as on construction. `Data#with` bypasses
  # `initialize` on Ruby 3.2, which would leave those arrays mutable.
  #
  # @example Replace the fetch URL
  #   info.with(url: ['https://example.com/other.git']).url
  #   # => ["https://example.com/other.git"]
  #
  # @param fields [Hash{Symbol => Object}] the fields to replace, keyed by
  #   member name
  #
  # @option fields [String] :name the name of the remote
  #
  # @option fields [Array<String>] :url fetch URLs
  #
  # @option fields [Array<String>] :push_url push URLs
  #
  # @option fields [Array<String>] :fetch fetch refspecs
  #
  # @option fields [Array<String>] :push push refspecs
  #
  # @option fields [Boolean, nil] :mirror mirror flag
  #
  # @option fields [Boolean, nil] :skip_default_update skip-default-update flag
  #
  # @option fields [String, nil] :tag_opt tag-fetching option
  #
  # @option fields [Boolean, nil] :prune prune flag
  #
  # @option fields [Boolean, nil] :prune_tags prune-tags flag
  #
  # @option fields [String, nil] :receivepack receive-pack path
  #
  # @option fields [String, nil] :uploadpack upload-pack path
  #
  # @option fields [Boolean, nil] :promisor promisor flag
  #
  # @option fields [String, nil] :partial_clone_filter partial-clone filter
  #
  # @option fields [String, nil] :vcs VCS type
  #
  # @return [Git::RemoteInfo] a new instance; `self` when no fields are given
  #
  # @raise [ArgumentError] if a key is not a member of this Data class
  #
  def with(**fields)
    return self if fields.empty?

    self.class.new(**to_h, **fields)
  end
end

#prune_tagsBoolean? (readonly)

Returns true/false per remote.<name>.pruneTags; nil inherits fetch.pruneTags.

Returns:

  • (Boolean, nil)

    true/false per remote.<name>.pruneTags; nil inherits fetch.pruneTags



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/git/remote_info.rb', line 74

RemoteInfo = Data.define(
  :name,
  :url,
  :push_url,
  :fetch,
  :push,
  :mirror,
  :skip_default_update,
  :tag_opt,
  :prune,
  :prune_tags,
  :receivepack,
  :uploadpack,
  :promisor,
  :partial_clone_filter,
  :vcs
) do
  # Create a new RemoteInfo
  #
  # @param name [String] the name of the remote (required)
  #
  # @param url [Array<String>] fetch URLs (default `[]`); stored as a frozen copy
  #
  # @param push_url [Array<String>] push URLs (default `[]`); stored as a frozen copy
  #
  # @param fetch [Array<String>] fetch refspecs (default `[]`); stored as a frozen copy
  #
  # @param push [Array<String>] push refspecs (default `[]`); stored as a frozen copy
  #
  # @param mirror [Boolean, nil] mirror flag (default `nil`)
  #
  # @param skip_default_update [Boolean, nil] skip-default-update flag (default `nil`)
  #
  # @param tag_opt [String, nil] tag-fetching option (default `nil`)
  #
  # @param prune [Boolean, nil] prune flag (default `nil`)
  #
  # @param prune_tags [Boolean, nil] prune-tags flag (default `nil`)
  #
  # @param receivepack [String, nil] receive-pack path (default `nil`)
  #
  # @param uploadpack [String, nil] upload-pack path (default `nil`)
  #
  # @param promisor [Boolean, nil] promisor flag (default `nil`)
  #
  # @param partial_clone_filter [String, nil] partial-clone filter (default `nil`)
  #
  # @param vcs [String, nil] VCS type (default `nil`)
  #
  # @return [Git::RemoteInfo]
  #
  def initialize( # rubocop:disable Metrics/ParameterLists
    name:,
    url: [],
    push_url: [],
    fetch: [],
    push: [],
    mirror: nil,
    skip_default_update: nil,
    tag_opt: nil,
    prune: nil,
    prune_tags: nil,
    receivepack: nil,
    uploadpack: nil,
    promisor: nil,
    partial_clone_filter: nil,
    vcs: nil
  )
    super(
      name:, url: Array(url).dup.freeze, push_url: Array(push_url).dup.freeze,
      fetch: Array(fetch).dup.freeze, push: Array(push).dup.freeze, mirror:,
      skip_default_update:, tag_opt:, prune:, prune_tags:, receivepack:, uploadpack:,
      promisor:, partial_clone_filter:, vcs:
    )
  end

  # Return a copy of this RemoteInfo with the given fields replaced
  #
  # Routes through {#initialize} so the multi-value fields of the copy are
  # frozen copies, the same as on construction. `Data#with` bypasses
  # `initialize` on Ruby 3.2, which would leave those arrays mutable.
  #
  # @example Replace the fetch URL
  #   info.with(url: ['https://example.com/other.git']).url
  #   # => ["https://example.com/other.git"]
  #
  # @param fields [Hash{Symbol => Object}] the fields to replace, keyed by
  #   member name
  #
  # @option fields [String] :name the name of the remote
  #
  # @option fields [Array<String>] :url fetch URLs
  #
  # @option fields [Array<String>] :push_url push URLs
  #
  # @option fields [Array<String>] :fetch fetch refspecs
  #
  # @option fields [Array<String>] :push push refspecs
  #
  # @option fields [Boolean, nil] :mirror mirror flag
  #
  # @option fields [Boolean, nil] :skip_default_update skip-default-update flag
  #
  # @option fields [String, nil] :tag_opt tag-fetching option
  #
  # @option fields [Boolean, nil] :prune prune flag
  #
  # @option fields [Boolean, nil] :prune_tags prune-tags flag
  #
  # @option fields [String, nil] :receivepack receive-pack path
  #
  # @option fields [String, nil] :uploadpack upload-pack path
  #
  # @option fields [Boolean, nil] :promisor promisor flag
  #
  # @option fields [String, nil] :partial_clone_filter partial-clone filter
  #
  # @option fields [String, nil] :vcs VCS type
  #
  # @return [Git::RemoteInfo] a new instance; `self` when no fields are given
  #
  # @raise [ArgumentError] if a key is not a member of this Data class
  #
  def with(**fields)
    return self if fields.empty?

    self.class.new(**to_h, **fields)
  end
end

#pushArray<String> (readonly)

Returns the push refspec(s) for this remote (remote.<name>.push).

Returns:

  • (Array<String>)

    the push refspec(s) for this remote (remote.<name>.push)



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/git/remote_info.rb', line 74

RemoteInfo = Data.define(
  :name,
  :url,
  :push_url,
  :fetch,
  :push,
  :mirror,
  :skip_default_update,
  :tag_opt,
  :prune,
  :prune_tags,
  :receivepack,
  :uploadpack,
  :promisor,
  :partial_clone_filter,
  :vcs
) do
  # Create a new RemoteInfo
  #
  # @param name [String] the name of the remote (required)
  #
  # @param url [Array<String>] fetch URLs (default `[]`); stored as a frozen copy
  #
  # @param push_url [Array<String>] push URLs (default `[]`); stored as a frozen copy
  #
  # @param fetch [Array<String>] fetch refspecs (default `[]`); stored as a frozen copy
  #
  # @param push [Array<String>] push refspecs (default `[]`); stored as a frozen copy
  #
  # @param mirror [Boolean, nil] mirror flag (default `nil`)
  #
  # @param skip_default_update [Boolean, nil] skip-default-update flag (default `nil`)
  #
  # @param tag_opt [String, nil] tag-fetching option (default `nil`)
  #
  # @param prune [Boolean, nil] prune flag (default `nil`)
  #
  # @param prune_tags [Boolean, nil] prune-tags flag (default `nil`)
  #
  # @param receivepack [String, nil] receive-pack path (default `nil`)
  #
  # @param uploadpack [String, nil] upload-pack path (default `nil`)
  #
  # @param promisor [Boolean, nil] promisor flag (default `nil`)
  #
  # @param partial_clone_filter [String, nil] partial-clone filter (default `nil`)
  #
  # @param vcs [String, nil] VCS type (default `nil`)
  #
  # @return [Git::RemoteInfo]
  #
  def initialize( # rubocop:disable Metrics/ParameterLists
    name:,
    url: [],
    push_url: [],
    fetch: [],
    push: [],
    mirror: nil,
    skip_default_update: nil,
    tag_opt: nil,
    prune: nil,
    prune_tags: nil,
    receivepack: nil,
    uploadpack: nil,
    promisor: nil,
    partial_clone_filter: nil,
    vcs: nil
  )
    super(
      name:, url: Array(url).dup.freeze, push_url: Array(push_url).dup.freeze,
      fetch: Array(fetch).dup.freeze, push: Array(push).dup.freeze, mirror:,
      skip_default_update:, tag_opt:, prune:, prune_tags:, receivepack:, uploadpack:,
      promisor:, partial_clone_filter:, vcs:
    )
  end

  # Return a copy of this RemoteInfo with the given fields replaced
  #
  # Routes through {#initialize} so the multi-value fields of the copy are
  # frozen copies, the same as on construction. `Data#with` bypasses
  # `initialize` on Ruby 3.2, which would leave those arrays mutable.
  #
  # @example Replace the fetch URL
  #   info.with(url: ['https://example.com/other.git']).url
  #   # => ["https://example.com/other.git"]
  #
  # @param fields [Hash{Symbol => Object}] the fields to replace, keyed by
  #   member name
  #
  # @option fields [String] :name the name of the remote
  #
  # @option fields [Array<String>] :url fetch URLs
  #
  # @option fields [Array<String>] :push_url push URLs
  #
  # @option fields [Array<String>] :fetch fetch refspecs
  #
  # @option fields [Array<String>] :push push refspecs
  #
  # @option fields [Boolean, nil] :mirror mirror flag
  #
  # @option fields [Boolean, nil] :skip_default_update skip-default-update flag
  #
  # @option fields [String, nil] :tag_opt tag-fetching option
  #
  # @option fields [Boolean, nil] :prune prune flag
  #
  # @option fields [Boolean, nil] :prune_tags prune-tags flag
  #
  # @option fields [String, nil] :receivepack receive-pack path
  #
  # @option fields [String, nil] :uploadpack upload-pack path
  #
  # @option fields [Boolean, nil] :promisor promisor flag
  #
  # @option fields [String, nil] :partial_clone_filter partial-clone filter
  #
  # @option fields [String, nil] :vcs VCS type
  #
  # @return [Git::RemoteInfo] a new instance; `self` when no fields are given
  #
  # @raise [ArgumentError] if a key is not a member of this Data class
  #
  def with(**fields)
    return self if fields.empty?

    self.class.new(**to_h, **fields)
  end
end

#push_urlArray<String> (readonly)

Returns the push URL(s) for this remote (remote.<name>.pushurl).

Returns:

  • (Array<String>)

    the push URL(s) for this remote (remote.<name>.pushurl)



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/git/remote_info.rb', line 74

RemoteInfo = Data.define(
  :name,
  :url,
  :push_url,
  :fetch,
  :push,
  :mirror,
  :skip_default_update,
  :tag_opt,
  :prune,
  :prune_tags,
  :receivepack,
  :uploadpack,
  :promisor,
  :partial_clone_filter,
  :vcs
) do
  # Create a new RemoteInfo
  #
  # @param name [String] the name of the remote (required)
  #
  # @param url [Array<String>] fetch URLs (default `[]`); stored as a frozen copy
  #
  # @param push_url [Array<String>] push URLs (default `[]`); stored as a frozen copy
  #
  # @param fetch [Array<String>] fetch refspecs (default `[]`); stored as a frozen copy
  #
  # @param push [Array<String>] push refspecs (default `[]`); stored as a frozen copy
  #
  # @param mirror [Boolean, nil] mirror flag (default `nil`)
  #
  # @param skip_default_update [Boolean, nil] skip-default-update flag (default `nil`)
  #
  # @param tag_opt [String, nil] tag-fetching option (default `nil`)
  #
  # @param prune [Boolean, nil] prune flag (default `nil`)
  #
  # @param prune_tags [Boolean, nil] prune-tags flag (default `nil`)
  #
  # @param receivepack [String, nil] receive-pack path (default `nil`)
  #
  # @param uploadpack [String, nil] upload-pack path (default `nil`)
  #
  # @param promisor [Boolean, nil] promisor flag (default `nil`)
  #
  # @param partial_clone_filter [String, nil] partial-clone filter (default `nil`)
  #
  # @param vcs [String, nil] VCS type (default `nil`)
  #
  # @return [Git::RemoteInfo]
  #
  def initialize( # rubocop:disable Metrics/ParameterLists
    name:,
    url: [],
    push_url: [],
    fetch: [],
    push: [],
    mirror: nil,
    skip_default_update: nil,
    tag_opt: nil,
    prune: nil,
    prune_tags: nil,
    receivepack: nil,
    uploadpack: nil,
    promisor: nil,
    partial_clone_filter: nil,
    vcs: nil
  )
    super(
      name:, url: Array(url).dup.freeze, push_url: Array(push_url).dup.freeze,
      fetch: Array(fetch).dup.freeze, push: Array(push).dup.freeze, mirror:,
      skip_default_update:, tag_opt:, prune:, prune_tags:, receivepack:, uploadpack:,
      promisor:, partial_clone_filter:, vcs:
    )
  end

  # Return a copy of this RemoteInfo with the given fields replaced
  #
  # Routes through {#initialize} so the multi-value fields of the copy are
  # frozen copies, the same as on construction. `Data#with` bypasses
  # `initialize` on Ruby 3.2, which would leave those arrays mutable.
  #
  # @example Replace the fetch URL
  #   info.with(url: ['https://example.com/other.git']).url
  #   # => ["https://example.com/other.git"]
  #
  # @param fields [Hash{Symbol => Object}] the fields to replace, keyed by
  #   member name
  #
  # @option fields [String] :name the name of the remote
  #
  # @option fields [Array<String>] :url fetch URLs
  #
  # @option fields [Array<String>] :push_url push URLs
  #
  # @option fields [Array<String>] :fetch fetch refspecs
  #
  # @option fields [Array<String>] :push push refspecs
  #
  # @option fields [Boolean, nil] :mirror mirror flag
  #
  # @option fields [Boolean, nil] :skip_default_update skip-default-update flag
  #
  # @option fields [String, nil] :tag_opt tag-fetching option
  #
  # @option fields [Boolean, nil] :prune prune flag
  #
  # @option fields [Boolean, nil] :prune_tags prune-tags flag
  #
  # @option fields [String, nil] :receivepack receive-pack path
  #
  # @option fields [String, nil] :uploadpack upload-pack path
  #
  # @option fields [Boolean, nil] :promisor promisor flag
  #
  # @option fields [String, nil] :partial_clone_filter partial-clone filter
  #
  # @option fields [String, nil] :vcs VCS type
  #
  # @return [Git::RemoteInfo] a new instance; `self` when no fields are given
  #
  # @raise [ArgumentError] if a key is not a member of this Data class
  #
  def with(**fields)
    return self if fields.empty?

    self.class.new(**to_h, **fields)
  end
end

#receivepackString? (readonly)

Returns the git-receive-pack path on the remote (remote.<name>.receivepack).

Returns:

  • (String, nil)

    the git-receive-pack path on the remote (remote.<name>.receivepack)



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/git/remote_info.rb', line 74

RemoteInfo = Data.define(
  :name,
  :url,
  :push_url,
  :fetch,
  :push,
  :mirror,
  :skip_default_update,
  :tag_opt,
  :prune,
  :prune_tags,
  :receivepack,
  :uploadpack,
  :promisor,
  :partial_clone_filter,
  :vcs
) do
  # Create a new RemoteInfo
  #
  # @param name [String] the name of the remote (required)
  #
  # @param url [Array<String>] fetch URLs (default `[]`); stored as a frozen copy
  #
  # @param push_url [Array<String>] push URLs (default `[]`); stored as a frozen copy
  #
  # @param fetch [Array<String>] fetch refspecs (default `[]`); stored as a frozen copy
  #
  # @param push [Array<String>] push refspecs (default `[]`); stored as a frozen copy
  #
  # @param mirror [Boolean, nil] mirror flag (default `nil`)
  #
  # @param skip_default_update [Boolean, nil] skip-default-update flag (default `nil`)
  #
  # @param tag_opt [String, nil] tag-fetching option (default `nil`)
  #
  # @param prune [Boolean, nil] prune flag (default `nil`)
  #
  # @param prune_tags [Boolean, nil] prune-tags flag (default `nil`)
  #
  # @param receivepack [String, nil] receive-pack path (default `nil`)
  #
  # @param uploadpack [String, nil] upload-pack path (default `nil`)
  #
  # @param promisor [Boolean, nil] promisor flag (default `nil`)
  #
  # @param partial_clone_filter [String, nil] partial-clone filter (default `nil`)
  #
  # @param vcs [String, nil] VCS type (default `nil`)
  #
  # @return [Git::RemoteInfo]
  #
  def initialize( # rubocop:disable Metrics/ParameterLists
    name:,
    url: [],
    push_url: [],
    fetch: [],
    push: [],
    mirror: nil,
    skip_default_update: nil,
    tag_opt: nil,
    prune: nil,
    prune_tags: nil,
    receivepack: nil,
    uploadpack: nil,
    promisor: nil,
    partial_clone_filter: nil,
    vcs: nil
  )
    super(
      name:, url: Array(url).dup.freeze, push_url: Array(push_url).dup.freeze,
      fetch: Array(fetch).dup.freeze, push: Array(push).dup.freeze, mirror:,
      skip_default_update:, tag_opt:, prune:, prune_tags:, receivepack:, uploadpack:,
      promisor:, partial_clone_filter:, vcs:
    )
  end

  # Return a copy of this RemoteInfo with the given fields replaced
  #
  # Routes through {#initialize} so the multi-value fields of the copy are
  # frozen copies, the same as on construction. `Data#with` bypasses
  # `initialize` on Ruby 3.2, which would leave those arrays mutable.
  #
  # @example Replace the fetch URL
  #   info.with(url: ['https://example.com/other.git']).url
  #   # => ["https://example.com/other.git"]
  #
  # @param fields [Hash{Symbol => Object}] the fields to replace, keyed by
  #   member name
  #
  # @option fields [String] :name the name of the remote
  #
  # @option fields [Array<String>] :url fetch URLs
  #
  # @option fields [Array<String>] :push_url push URLs
  #
  # @option fields [Array<String>] :fetch fetch refspecs
  #
  # @option fields [Array<String>] :push push refspecs
  #
  # @option fields [Boolean, nil] :mirror mirror flag
  #
  # @option fields [Boolean, nil] :skip_default_update skip-default-update flag
  #
  # @option fields [String, nil] :tag_opt tag-fetching option
  #
  # @option fields [Boolean, nil] :prune prune flag
  #
  # @option fields [Boolean, nil] :prune_tags prune-tags flag
  #
  # @option fields [String, nil] :receivepack receive-pack path
  #
  # @option fields [String, nil] :uploadpack upload-pack path
  #
  # @option fields [Boolean, nil] :promisor promisor flag
  #
  # @option fields [String, nil] :partial_clone_filter partial-clone filter
  #
  # @option fields [String, nil] :vcs VCS type
  #
  # @return [Git::RemoteInfo] a new instance; `self` when no fields are given
  #
  # @raise [ArgumentError] if a key is not a member of this Data class
  #
  def with(**fields)
    return self if fields.empty?

    self.class.new(**to_h, **fields)
  end
end

#skip_default_updateBoolean? (readonly)

Returns true/false per remote.<name>.skipDefaultUpdate, or nil when not set.

Returns:

  • (Boolean, nil)

    true/false per remote.<name>.skipDefaultUpdate, or nil when not set



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/git/remote_info.rb', line 74

RemoteInfo = Data.define(
  :name,
  :url,
  :push_url,
  :fetch,
  :push,
  :mirror,
  :skip_default_update,
  :tag_opt,
  :prune,
  :prune_tags,
  :receivepack,
  :uploadpack,
  :promisor,
  :partial_clone_filter,
  :vcs
) do
  # Create a new RemoteInfo
  #
  # @param name [String] the name of the remote (required)
  #
  # @param url [Array<String>] fetch URLs (default `[]`); stored as a frozen copy
  #
  # @param push_url [Array<String>] push URLs (default `[]`); stored as a frozen copy
  #
  # @param fetch [Array<String>] fetch refspecs (default `[]`); stored as a frozen copy
  #
  # @param push [Array<String>] push refspecs (default `[]`); stored as a frozen copy
  #
  # @param mirror [Boolean, nil] mirror flag (default `nil`)
  #
  # @param skip_default_update [Boolean, nil] skip-default-update flag (default `nil`)
  #
  # @param tag_opt [String, nil] tag-fetching option (default `nil`)
  #
  # @param prune [Boolean, nil] prune flag (default `nil`)
  #
  # @param prune_tags [Boolean, nil] prune-tags flag (default `nil`)
  #
  # @param receivepack [String, nil] receive-pack path (default `nil`)
  #
  # @param uploadpack [String, nil] upload-pack path (default `nil`)
  #
  # @param promisor [Boolean, nil] promisor flag (default `nil`)
  #
  # @param partial_clone_filter [String, nil] partial-clone filter (default `nil`)
  #
  # @param vcs [String, nil] VCS type (default `nil`)
  #
  # @return [Git::RemoteInfo]
  #
  def initialize( # rubocop:disable Metrics/ParameterLists
    name:,
    url: [],
    push_url: [],
    fetch: [],
    push: [],
    mirror: nil,
    skip_default_update: nil,
    tag_opt: nil,
    prune: nil,
    prune_tags: nil,
    receivepack: nil,
    uploadpack: nil,
    promisor: nil,
    partial_clone_filter: nil,
    vcs: nil
  )
    super(
      name:, url: Array(url).dup.freeze, push_url: Array(push_url).dup.freeze,
      fetch: Array(fetch).dup.freeze, push: Array(push).dup.freeze, mirror:,
      skip_default_update:, tag_opt:, prune:, prune_tags:, receivepack:, uploadpack:,
      promisor:, partial_clone_filter:, vcs:
    )
  end

  # Return a copy of this RemoteInfo with the given fields replaced
  #
  # Routes through {#initialize} so the multi-value fields of the copy are
  # frozen copies, the same as on construction. `Data#with` bypasses
  # `initialize` on Ruby 3.2, which would leave those arrays mutable.
  #
  # @example Replace the fetch URL
  #   info.with(url: ['https://example.com/other.git']).url
  #   # => ["https://example.com/other.git"]
  #
  # @param fields [Hash{Symbol => Object}] the fields to replace, keyed by
  #   member name
  #
  # @option fields [String] :name the name of the remote
  #
  # @option fields [Array<String>] :url fetch URLs
  #
  # @option fields [Array<String>] :push_url push URLs
  #
  # @option fields [Array<String>] :fetch fetch refspecs
  #
  # @option fields [Array<String>] :push push refspecs
  #
  # @option fields [Boolean, nil] :mirror mirror flag
  #
  # @option fields [Boolean, nil] :skip_default_update skip-default-update flag
  #
  # @option fields [String, nil] :tag_opt tag-fetching option
  #
  # @option fields [Boolean, nil] :prune prune flag
  #
  # @option fields [Boolean, nil] :prune_tags prune-tags flag
  #
  # @option fields [String, nil] :receivepack receive-pack path
  #
  # @option fields [String, nil] :uploadpack upload-pack path
  #
  # @option fields [Boolean, nil] :promisor promisor flag
  #
  # @option fields [String, nil] :partial_clone_filter partial-clone filter
  #
  # @option fields [String, nil] :vcs VCS type
  #
  # @return [Git::RemoteInfo] a new instance; `self` when no fields are given
  #
  # @raise [ArgumentError] if a key is not a member of this Data class
  #
  def with(**fields)
    return self if fields.empty?

    self.class.new(**to_h, **fields)
  end
end

#tag_optString? (readonly)

Returns the tag-fetching option (remote.<name>.tagOpt), or nil when not set.

Returns:

  • (String, nil)

    the tag-fetching option (remote.<name>.tagOpt), or nil when not set



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/git/remote_info.rb', line 74

RemoteInfo = Data.define(
  :name,
  :url,
  :push_url,
  :fetch,
  :push,
  :mirror,
  :skip_default_update,
  :tag_opt,
  :prune,
  :prune_tags,
  :receivepack,
  :uploadpack,
  :promisor,
  :partial_clone_filter,
  :vcs
) do
  # Create a new RemoteInfo
  #
  # @param name [String] the name of the remote (required)
  #
  # @param url [Array<String>] fetch URLs (default `[]`); stored as a frozen copy
  #
  # @param push_url [Array<String>] push URLs (default `[]`); stored as a frozen copy
  #
  # @param fetch [Array<String>] fetch refspecs (default `[]`); stored as a frozen copy
  #
  # @param push [Array<String>] push refspecs (default `[]`); stored as a frozen copy
  #
  # @param mirror [Boolean, nil] mirror flag (default `nil`)
  #
  # @param skip_default_update [Boolean, nil] skip-default-update flag (default `nil`)
  #
  # @param tag_opt [String, nil] tag-fetching option (default `nil`)
  #
  # @param prune [Boolean, nil] prune flag (default `nil`)
  #
  # @param prune_tags [Boolean, nil] prune-tags flag (default `nil`)
  #
  # @param receivepack [String, nil] receive-pack path (default `nil`)
  #
  # @param uploadpack [String, nil] upload-pack path (default `nil`)
  #
  # @param promisor [Boolean, nil] promisor flag (default `nil`)
  #
  # @param partial_clone_filter [String, nil] partial-clone filter (default `nil`)
  #
  # @param vcs [String, nil] VCS type (default `nil`)
  #
  # @return [Git::RemoteInfo]
  #
  def initialize( # rubocop:disable Metrics/ParameterLists
    name:,
    url: [],
    push_url: [],
    fetch: [],
    push: [],
    mirror: nil,
    skip_default_update: nil,
    tag_opt: nil,
    prune: nil,
    prune_tags: nil,
    receivepack: nil,
    uploadpack: nil,
    promisor: nil,
    partial_clone_filter: nil,
    vcs: nil
  )
    super(
      name:, url: Array(url).dup.freeze, push_url: Array(push_url).dup.freeze,
      fetch: Array(fetch).dup.freeze, push: Array(push).dup.freeze, mirror:,
      skip_default_update:, tag_opt:, prune:, prune_tags:, receivepack:, uploadpack:,
      promisor:, partial_clone_filter:, vcs:
    )
  end

  # Return a copy of this RemoteInfo with the given fields replaced
  #
  # Routes through {#initialize} so the multi-value fields of the copy are
  # frozen copies, the same as on construction. `Data#with` bypasses
  # `initialize` on Ruby 3.2, which would leave those arrays mutable.
  #
  # @example Replace the fetch URL
  #   info.with(url: ['https://example.com/other.git']).url
  #   # => ["https://example.com/other.git"]
  #
  # @param fields [Hash{Symbol => Object}] the fields to replace, keyed by
  #   member name
  #
  # @option fields [String] :name the name of the remote
  #
  # @option fields [Array<String>] :url fetch URLs
  #
  # @option fields [Array<String>] :push_url push URLs
  #
  # @option fields [Array<String>] :fetch fetch refspecs
  #
  # @option fields [Array<String>] :push push refspecs
  #
  # @option fields [Boolean, nil] :mirror mirror flag
  #
  # @option fields [Boolean, nil] :skip_default_update skip-default-update flag
  #
  # @option fields [String, nil] :tag_opt tag-fetching option
  #
  # @option fields [Boolean, nil] :prune prune flag
  #
  # @option fields [Boolean, nil] :prune_tags prune-tags flag
  #
  # @option fields [String, nil] :receivepack receive-pack path
  #
  # @option fields [String, nil] :uploadpack upload-pack path
  #
  # @option fields [Boolean, nil] :promisor promisor flag
  #
  # @option fields [String, nil] :partial_clone_filter partial-clone filter
  #
  # @option fields [String, nil] :vcs VCS type
  #
  # @return [Git::RemoteInfo] a new instance; `self` when no fields are given
  #
  # @raise [ArgumentError] if a key is not a member of this Data class
  #
  def with(**fields)
    return self if fields.empty?

    self.class.new(**to_h, **fields)
  end
end

#uploadpackString? (readonly)

Returns the git-upload-pack path on the remote (remote.<name>.uploadpack).

Returns:

  • (String, nil)

    the git-upload-pack path on the remote (remote.<name>.uploadpack)



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/git/remote_info.rb', line 74

RemoteInfo = Data.define(
  :name,
  :url,
  :push_url,
  :fetch,
  :push,
  :mirror,
  :skip_default_update,
  :tag_opt,
  :prune,
  :prune_tags,
  :receivepack,
  :uploadpack,
  :promisor,
  :partial_clone_filter,
  :vcs
) do
  # Create a new RemoteInfo
  #
  # @param name [String] the name of the remote (required)
  #
  # @param url [Array<String>] fetch URLs (default `[]`); stored as a frozen copy
  #
  # @param push_url [Array<String>] push URLs (default `[]`); stored as a frozen copy
  #
  # @param fetch [Array<String>] fetch refspecs (default `[]`); stored as a frozen copy
  #
  # @param push [Array<String>] push refspecs (default `[]`); stored as a frozen copy
  #
  # @param mirror [Boolean, nil] mirror flag (default `nil`)
  #
  # @param skip_default_update [Boolean, nil] skip-default-update flag (default `nil`)
  #
  # @param tag_opt [String, nil] tag-fetching option (default `nil`)
  #
  # @param prune [Boolean, nil] prune flag (default `nil`)
  #
  # @param prune_tags [Boolean, nil] prune-tags flag (default `nil`)
  #
  # @param receivepack [String, nil] receive-pack path (default `nil`)
  #
  # @param uploadpack [String, nil] upload-pack path (default `nil`)
  #
  # @param promisor [Boolean, nil] promisor flag (default `nil`)
  #
  # @param partial_clone_filter [String, nil] partial-clone filter (default `nil`)
  #
  # @param vcs [String, nil] VCS type (default `nil`)
  #
  # @return [Git::RemoteInfo]
  #
  def initialize( # rubocop:disable Metrics/ParameterLists
    name:,
    url: [],
    push_url: [],
    fetch: [],
    push: [],
    mirror: nil,
    skip_default_update: nil,
    tag_opt: nil,
    prune: nil,
    prune_tags: nil,
    receivepack: nil,
    uploadpack: nil,
    promisor: nil,
    partial_clone_filter: nil,
    vcs: nil
  )
    super(
      name:, url: Array(url).dup.freeze, push_url: Array(push_url).dup.freeze,
      fetch: Array(fetch).dup.freeze, push: Array(push).dup.freeze, mirror:,
      skip_default_update:, tag_opt:, prune:, prune_tags:, receivepack:, uploadpack:,
      promisor:, partial_clone_filter:, vcs:
    )
  end

  # Return a copy of this RemoteInfo with the given fields replaced
  #
  # Routes through {#initialize} so the multi-value fields of the copy are
  # frozen copies, the same as on construction. `Data#with` bypasses
  # `initialize` on Ruby 3.2, which would leave those arrays mutable.
  #
  # @example Replace the fetch URL
  #   info.with(url: ['https://example.com/other.git']).url
  #   # => ["https://example.com/other.git"]
  #
  # @param fields [Hash{Symbol => Object}] the fields to replace, keyed by
  #   member name
  #
  # @option fields [String] :name the name of the remote
  #
  # @option fields [Array<String>] :url fetch URLs
  #
  # @option fields [Array<String>] :push_url push URLs
  #
  # @option fields [Array<String>] :fetch fetch refspecs
  #
  # @option fields [Array<String>] :push push refspecs
  #
  # @option fields [Boolean, nil] :mirror mirror flag
  #
  # @option fields [Boolean, nil] :skip_default_update skip-default-update flag
  #
  # @option fields [String, nil] :tag_opt tag-fetching option
  #
  # @option fields [Boolean, nil] :prune prune flag
  #
  # @option fields [Boolean, nil] :prune_tags prune-tags flag
  #
  # @option fields [String, nil] :receivepack receive-pack path
  #
  # @option fields [String, nil] :uploadpack upload-pack path
  #
  # @option fields [Boolean, nil] :promisor promisor flag
  #
  # @option fields [String, nil] :partial_clone_filter partial-clone filter
  #
  # @option fields [String, nil] :vcs VCS type
  #
  # @return [Git::RemoteInfo] a new instance; `self` when no fields are given
  #
  # @raise [ArgumentError] if a key is not a member of this Data class
  #
  def with(**fields)
    return self if fields.empty?

    self.class.new(**to_h, **fields)
  end
end

#urlArray<String> (readonly)

Returns the fetch URL(s) for this remote (remote.<name>.url).

Returns:

  • (Array<String>)

    the fetch URL(s) for this remote (remote.<name>.url)



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/git/remote_info.rb', line 74

RemoteInfo = Data.define(
  :name,
  :url,
  :push_url,
  :fetch,
  :push,
  :mirror,
  :skip_default_update,
  :tag_opt,
  :prune,
  :prune_tags,
  :receivepack,
  :uploadpack,
  :promisor,
  :partial_clone_filter,
  :vcs
) do
  # Create a new RemoteInfo
  #
  # @param name [String] the name of the remote (required)
  #
  # @param url [Array<String>] fetch URLs (default `[]`); stored as a frozen copy
  #
  # @param push_url [Array<String>] push URLs (default `[]`); stored as a frozen copy
  #
  # @param fetch [Array<String>] fetch refspecs (default `[]`); stored as a frozen copy
  #
  # @param push [Array<String>] push refspecs (default `[]`); stored as a frozen copy
  #
  # @param mirror [Boolean, nil] mirror flag (default `nil`)
  #
  # @param skip_default_update [Boolean, nil] skip-default-update flag (default `nil`)
  #
  # @param tag_opt [String, nil] tag-fetching option (default `nil`)
  #
  # @param prune [Boolean, nil] prune flag (default `nil`)
  #
  # @param prune_tags [Boolean, nil] prune-tags flag (default `nil`)
  #
  # @param receivepack [String, nil] receive-pack path (default `nil`)
  #
  # @param uploadpack [String, nil] upload-pack path (default `nil`)
  #
  # @param promisor [Boolean, nil] promisor flag (default `nil`)
  #
  # @param partial_clone_filter [String, nil] partial-clone filter (default `nil`)
  #
  # @param vcs [String, nil] VCS type (default `nil`)
  #
  # @return [Git::RemoteInfo]
  #
  def initialize( # rubocop:disable Metrics/ParameterLists
    name:,
    url: [],
    push_url: [],
    fetch: [],
    push: [],
    mirror: nil,
    skip_default_update: nil,
    tag_opt: nil,
    prune: nil,
    prune_tags: nil,
    receivepack: nil,
    uploadpack: nil,
    promisor: nil,
    partial_clone_filter: nil,
    vcs: nil
  )
    super(
      name:, url: Array(url).dup.freeze, push_url: Array(push_url).dup.freeze,
      fetch: Array(fetch).dup.freeze, push: Array(push).dup.freeze, mirror:,
      skip_default_update:, tag_opt:, prune:, prune_tags:, receivepack:, uploadpack:,
      promisor:, partial_clone_filter:, vcs:
    )
  end

  # Return a copy of this RemoteInfo with the given fields replaced
  #
  # Routes through {#initialize} so the multi-value fields of the copy are
  # frozen copies, the same as on construction. `Data#with` bypasses
  # `initialize` on Ruby 3.2, which would leave those arrays mutable.
  #
  # @example Replace the fetch URL
  #   info.with(url: ['https://example.com/other.git']).url
  #   # => ["https://example.com/other.git"]
  #
  # @param fields [Hash{Symbol => Object}] the fields to replace, keyed by
  #   member name
  #
  # @option fields [String] :name the name of the remote
  #
  # @option fields [Array<String>] :url fetch URLs
  #
  # @option fields [Array<String>] :push_url push URLs
  #
  # @option fields [Array<String>] :fetch fetch refspecs
  #
  # @option fields [Array<String>] :push push refspecs
  #
  # @option fields [Boolean, nil] :mirror mirror flag
  #
  # @option fields [Boolean, nil] :skip_default_update skip-default-update flag
  #
  # @option fields [String, nil] :tag_opt tag-fetching option
  #
  # @option fields [Boolean, nil] :prune prune flag
  #
  # @option fields [Boolean, nil] :prune_tags prune-tags flag
  #
  # @option fields [String, nil] :receivepack receive-pack path
  #
  # @option fields [String, nil] :uploadpack upload-pack path
  #
  # @option fields [Boolean, nil] :promisor promisor flag
  #
  # @option fields [String, nil] :partial_clone_filter partial-clone filter
  #
  # @option fields [String, nil] :vcs VCS type
  #
  # @return [Git::RemoteInfo] a new instance; `self` when no fields are given
  #
  # @raise [ArgumentError] if a key is not a member of this Data class
  #
  def with(**fields)
    return self if fields.empty?

    self.class.new(**to_h, **fields)
  end
end

#vcsString? (readonly)

Returns the VCS type for git-remote helpers (remote.<name>.vcs).

Returns:

  • (String, nil)

    the VCS type for git-remote helpers (remote.<name>.vcs)



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/git/remote_info.rb', line 74

RemoteInfo = Data.define(
  :name,
  :url,
  :push_url,
  :fetch,
  :push,
  :mirror,
  :skip_default_update,
  :tag_opt,
  :prune,
  :prune_tags,
  :receivepack,
  :uploadpack,
  :promisor,
  :partial_clone_filter,
  :vcs
) do
  # Create a new RemoteInfo
  #
  # @param name [String] the name of the remote (required)
  #
  # @param url [Array<String>] fetch URLs (default `[]`); stored as a frozen copy
  #
  # @param push_url [Array<String>] push URLs (default `[]`); stored as a frozen copy
  #
  # @param fetch [Array<String>] fetch refspecs (default `[]`); stored as a frozen copy
  #
  # @param push [Array<String>] push refspecs (default `[]`); stored as a frozen copy
  #
  # @param mirror [Boolean, nil] mirror flag (default `nil`)
  #
  # @param skip_default_update [Boolean, nil] skip-default-update flag (default `nil`)
  #
  # @param tag_opt [String, nil] tag-fetching option (default `nil`)
  #
  # @param prune [Boolean, nil] prune flag (default `nil`)
  #
  # @param prune_tags [Boolean, nil] prune-tags flag (default `nil`)
  #
  # @param receivepack [String, nil] receive-pack path (default `nil`)
  #
  # @param uploadpack [String, nil] upload-pack path (default `nil`)
  #
  # @param promisor [Boolean, nil] promisor flag (default `nil`)
  #
  # @param partial_clone_filter [String, nil] partial-clone filter (default `nil`)
  #
  # @param vcs [String, nil] VCS type (default `nil`)
  #
  # @return [Git::RemoteInfo]
  #
  def initialize( # rubocop:disable Metrics/ParameterLists
    name:,
    url: [],
    push_url: [],
    fetch: [],
    push: [],
    mirror: nil,
    skip_default_update: nil,
    tag_opt: nil,
    prune: nil,
    prune_tags: nil,
    receivepack: nil,
    uploadpack: nil,
    promisor: nil,
    partial_clone_filter: nil,
    vcs: nil
  )
    super(
      name:, url: Array(url).dup.freeze, push_url: Array(push_url).dup.freeze,
      fetch: Array(fetch).dup.freeze, push: Array(push).dup.freeze, mirror:,
      skip_default_update:, tag_opt:, prune:, prune_tags:, receivepack:, uploadpack:,
      promisor:, partial_clone_filter:, vcs:
    )
  end

  # Return a copy of this RemoteInfo with the given fields replaced
  #
  # Routes through {#initialize} so the multi-value fields of the copy are
  # frozen copies, the same as on construction. `Data#with` bypasses
  # `initialize` on Ruby 3.2, which would leave those arrays mutable.
  #
  # @example Replace the fetch URL
  #   info.with(url: ['https://example.com/other.git']).url
  #   # => ["https://example.com/other.git"]
  #
  # @param fields [Hash{Symbol => Object}] the fields to replace, keyed by
  #   member name
  #
  # @option fields [String] :name the name of the remote
  #
  # @option fields [Array<String>] :url fetch URLs
  #
  # @option fields [Array<String>] :push_url push URLs
  #
  # @option fields [Array<String>] :fetch fetch refspecs
  #
  # @option fields [Array<String>] :push push refspecs
  #
  # @option fields [Boolean, nil] :mirror mirror flag
  #
  # @option fields [Boolean, nil] :skip_default_update skip-default-update flag
  #
  # @option fields [String, nil] :tag_opt tag-fetching option
  #
  # @option fields [Boolean, nil] :prune prune flag
  #
  # @option fields [Boolean, nil] :prune_tags prune-tags flag
  #
  # @option fields [String, nil] :receivepack receive-pack path
  #
  # @option fields [String, nil] :uploadpack upload-pack path
  #
  # @option fields [Boolean, nil] :promisor promisor flag
  #
  # @option fields [String, nil] :partial_clone_filter partial-clone filter
  #
  # @option fields [String, nil] :vcs VCS type
  #
  # @return [Git::RemoteInfo] a new instance; `self` when no fields are given
  #
  # @raise [ArgumentError] if a key is not a member of this Data class
  #
  def with(**fields)
    return self if fields.empty?

    self.class.new(**to_h, **fields)
  end
end

Instance Method Details

#with(**fields) ⇒ Git::RemoteInfo

Return a copy of this RemoteInfo with the given fields replaced

Routes through #initialize so the multi-value fields of the copy are frozen copies, the same as on construction. Data#with bypasses initialize on Ruby 3.2, which would leave those arrays mutable.

Examples:

Replace the fetch URL

info.with(url: ['https://example.com/other.git']).url
# => ["https://example.com/other.git"]

Parameters:

  • fields (Hash{Symbol => Object})

    the fields to replace, keyed by member name

Options Hash (**fields):

  • :name (String)

    the name of the remote

  • :url (Array<String>)

    fetch URLs

  • :push_url (Array<String>)

    push URLs

  • :fetch (Array<String>)

    fetch refspecs

  • :push (Array<String>)

    push refspecs

  • :mirror (Boolean, nil)

    mirror flag

  • :skip_default_update (Boolean, nil)

    skip-default-update flag

  • :tag_opt (String, nil)

    tag-fetching option

  • :prune (Boolean, nil)

    prune flag

  • :prune_tags (Boolean, nil)

    prune-tags flag

  • :receivepack (String, nil)

    receive-pack path

  • :uploadpack (String, nil)

    upload-pack path

  • :promisor (Boolean, nil)

    promisor flag

  • :partial_clone_filter (String, nil)

    partial-clone filter

  • :vcs (String, nil)

    VCS type

Returns:

Raises:

  • (ArgumentError)

    if a key is not a member of this Data class



197
198
199
200
201
# File 'lib/git/remote_info.rb', line 197

def with(**fields)
  return self if fields.empty?

  self.class.new(**to_h, **fields)
end