@@ -46,9 +46,25 @@ public virtual RemoteCollection Remotes
46
46
/// </para>
47
47
/// </summary>
48
48
/// <param name="remote">The <see cref="Remote"/> to list from.</param>
49
- /// <param name="credentialsProvider">The optional <see cref="Func{Credentials}"/> used to connect to remote repository.</param>
50
49
/// <returns>The references in the <see cref="Remote"/> repository.</returns>
51
- public virtual IEnumerable < DirectReference > ListReferences ( Remote remote , CredentialsHandler credentialsProvider = null )
50
+ public virtual IEnumerable < DirectReference > ListReferences ( Remote remote )
51
+ {
52
+ return ListReferences ( remote , null ) ;
53
+ }
54
+
55
+ /// <summary>
56
+ /// List references in a <see cref="Remote"/> repository.
57
+ /// <para>
58
+ /// When the remote tips are ahead of the local ones, the retrieved
59
+ /// <see cref="DirectReference"/>s may point to non existing
60
+ /// <see cref="GitObject"/>s in the local repository. In that
61
+ /// case, <see cref="DirectReference.Target"/> will return <c>null</c>.
62
+ /// </para>
63
+ /// </summary>
64
+ /// <param name="remote">The <see cref="Remote"/> to list from.</param>
65
+ /// <param name="credentialsProvider">The <see cref="Func{Credentials}"/> used to connect to remote repository.</param>
66
+ /// <returns>The references in the <see cref="Remote"/> repository.</returns>
67
+ public virtual IEnumerable < DirectReference > ListReferences ( Remote remote , CredentialsHandler credentialsProvider )
52
68
{
53
69
Ensure . ArgumentNotNull ( remote , "remote" ) ;
54
70
@@ -116,14 +132,42 @@ static void DoFetch(RemoteSafeHandle remoteHandle, FetchOptions options, string
116
132
Proxy . git_remote_fetch ( remoteHandle , logMessage ) ;
117
133
}
118
134
135
+ /// <summary>
136
+ /// Fetch from the <see cref="Remote"/>.
137
+ /// </summary>
138
+ /// <param name="remote">The remote to fetch</param>
139
+ public virtual void Fetch ( Remote remote )
140
+ {
141
+ Fetch ( remote , ( FetchOptions ) null , null ) ;
142
+ }
143
+
144
+ /// <summary>
145
+ /// Fetch from the <see cref="Remote"/>.
146
+ /// </summary>
147
+ /// <param name="remote">The remote to fetch</param>
148
+ /// <param name="options"><see cref="FetchOptions"/> controlling fetch behavior</param>
149
+ public virtual void Fetch ( Remote remote , FetchOptions options )
150
+ {
151
+ Fetch ( remote , options , null ) ;
152
+ }
153
+
154
+ /// <summary>
155
+ /// Fetch from the <see cref="Remote"/>.
156
+ /// </summary>
157
+ /// <param name="remote">The remote to fetch</param>
158
+ /// <param name="logMessage">Message to use when updating the reflog.</param>
159
+ public virtual void Fetch ( Remote remote , string logMessage )
160
+ {
161
+ Fetch ( remote , ( FetchOptions ) null , logMessage ) ;
162
+ }
163
+
119
164
/// <summary>
120
165
/// Fetch from the <see cref="Remote"/>.
121
166
/// </summary>
122
167
/// <param name="remote">The remote to fetch</param>
123
168
/// <param name="options"><see cref="FetchOptions"/> controlling fetch behavior</param>
124
169
/// <param name="logMessage">Message to use when updating the reflog.</param>
125
- public virtual void Fetch ( Remote remote , FetchOptions options = null ,
126
- string logMessage = null )
170
+ public virtual void Fetch ( Remote remote , FetchOptions options , string logMessage )
127
171
{
128
172
Ensure . ArgumentNotNull ( remote , "remote" ) ;
129
173
@@ -133,15 +177,46 @@ public virtual void Fetch(Remote remote, FetchOptions options = null,
133
177
}
134
178
}
135
179
180
+ /// <summary>
181
+ /// Fetch from the <see cref="Remote"/>, using custom refspecs.
182
+ /// </summary>
183
+ /// <param name="remote">The remote to fetch</param>
184
+ /// <param name="refspecs">Refspecs to use, replacing the remote's fetch refspecs</param>
185
+ public virtual void Fetch ( Remote remote , IEnumerable < string > refspecs )
186
+ {
187
+ Fetch ( remote , refspecs , null , null ) ;
188
+ }
189
+
190
+ /// <summary>
191
+ /// Fetch from the <see cref="Remote"/>, using custom refspecs.
192
+ /// </summary>
193
+ /// <param name="remote">The remote to fetch</param>
194
+ /// <param name="refspecs">Refspecs to use, replacing the remote's fetch refspecs</param>
195
+ /// <param name="options"><see cref="FetchOptions"/> controlling fetch behavior</param>
196
+ public virtual void Fetch ( Remote remote , IEnumerable < string > refspecs , FetchOptions options )
197
+ {
198
+ Fetch ( remote , refspecs , options , null ) ;
199
+ }
200
+
201
+ /// <summary>
202
+ /// Fetch from the <see cref="Remote"/>, using custom refspecs.
203
+ /// </summary>
204
+ /// <param name="remote">The remote to fetch</param>
205
+ /// <param name="refspecs">Refspecs to use, replacing the remote's fetch refspecs</param>
206
+ /// <param name="logMessage">Message to use when updating the reflog.</param>
207
+ public virtual void Fetch ( Remote remote , IEnumerable < string > refspecs , string logMessage )
208
+ {
209
+ Fetch ( remote , refspecs , null , logMessage ) ;
210
+ }
211
+
136
212
/// <summary>
137
213
/// Fetch from the <see cref="Remote"/>, using custom refspecs.
138
214
/// </summary>
139
215
/// <param name="remote">The remote to fetch</param>
140
216
/// <param name="refspecs">Refspecs to use, replacing the remote's fetch refspecs</param>
141
217
/// <param name="options"><see cref="FetchOptions"/> controlling fetch behavior</param>
142
218
/// <param name="logMessage">Message to use when updating the reflog.</param>
143
- public virtual void Fetch ( Remote remote , IEnumerable < string > refspecs , FetchOptions options = null ,
144
- string logMessage = null )
219
+ public virtual void Fetch ( Remote remote , IEnumerable < string > refspecs , FetchOptions options , string logMessage )
145
220
{
146
221
Ensure . ArgumentNotNull ( remote , "remote" ) ;
147
222
Ensure . ArgumentNotNull ( refspecs , "refspecs" ) ;
@@ -154,6 +229,46 @@ public virtual void Fetch(Remote remote, IEnumerable<string> refspecs, FetchOpti
154
229
}
155
230
}
156
231
232
+ /// <summary>
233
+ /// Fetch from a url with a set of fetch refspecs
234
+ /// </summary>
235
+ /// <param name="url">The url to fetch from</param>
236
+ /// <param name="refspecs">The list of resfpecs to use</param>
237
+ public virtual void Fetch (
238
+ string url ,
239
+ IEnumerable < string > refspecs )
240
+ {
241
+ Fetch ( url , refspecs , null , null ) ;
242
+ }
243
+
244
+ /// <summary>
245
+ /// Fetch from a url with a set of fetch refspecs
246
+ /// </summary>
247
+ /// <param name="url">The url to fetch from</param>
248
+ /// <param name="refspecs">The list of resfpecs to use</param>
249
+ /// <param name="options"><see cref="FetchOptions"/> controlling fetch behavior</param>
250
+ public virtual void Fetch (
251
+ string url ,
252
+ IEnumerable < string > refspecs ,
253
+ FetchOptions options )
254
+ {
255
+ Fetch ( url , refspecs , options , null ) ;
256
+ }
257
+
258
+ /// <summary>
259
+ /// Fetch from a url with a set of fetch refspecs
260
+ /// </summary>
261
+ /// <param name="url">The url to fetch from</param>
262
+ /// <param name="refspecs">The list of resfpecs to use</param>
263
+ /// <param name="logMessage">Message to use when updating the reflog.</param>
264
+ public virtual void Fetch (
265
+ string url ,
266
+ IEnumerable < string > refspecs ,
267
+ string logMessage )
268
+ {
269
+ Fetch ( url , refspecs , null , logMessage ) ;
270
+ }
271
+
157
272
/// <summary>
158
273
/// Fetch from a url with a set of fetch refspecs
159
274
/// </summary>
@@ -164,8 +279,8 @@ public virtual void Fetch(Remote remote, IEnumerable<string> refspecs, FetchOpti
164
279
public virtual void Fetch (
165
280
string url ,
166
281
IEnumerable < string > refspecs ,
167
- FetchOptions options = null ,
168
- string logMessage = null )
282
+ FetchOptions options ,
283
+ string logMessage )
169
284
{
170
285
Ensure . ArgumentNotNull ( url , "url" ) ;
171
286
Ensure . ArgumentNotNull ( refspecs , "refspecs" ) ;
@@ -178,6 +293,24 @@ public virtual void Fetch(
178
293
}
179
294
}
180
295
296
+ /// <summary>
297
+ /// Push the objectish to the destination reference on the <see cref="Remote"/>.
298
+ /// </summary>
299
+ /// <param name="remote">The <see cref="Remote"/> to push to.</param>
300
+ /// <param name="objectish">The source objectish to push.</param>
301
+ /// <param name="destinationSpec">The reference to update on the remote.</param>
302
+ public virtual void Push (
303
+ Remote remote ,
304
+ string objectish ,
305
+ string destinationSpec )
306
+ {
307
+ Ensure . ArgumentNotNull ( objectish , "objectish" ) ;
308
+ Ensure . ArgumentNotNullOrEmptyString ( destinationSpec , "destinationSpec" ) ;
309
+
310
+ Push ( remote , string . Format ( CultureInfo . InvariantCulture ,
311
+ "{0}:{1}" , objectish , destinationSpec ) ) ;
312
+ }
313
+
181
314
/// <summary>
182
315
/// Push the objectish to the destination reference on the <see cref="Remote"/>.
183
316
/// </summary>
@@ -189,16 +322,28 @@ public virtual void Push(
189
322
Remote remote ,
190
323
string objectish ,
191
324
string destinationSpec ,
192
- PushOptions pushOptions = null )
325
+ PushOptions pushOptions )
193
326
{
194
- Ensure . ArgumentNotNull ( remote , "remote" ) ;
195
327
Ensure . ArgumentNotNull ( objectish , "objectish" ) ;
196
- Ensure . ArgumentNotNullOrEmptyString ( destinationSpec , destinationSpec ) ;
328
+ Ensure . ArgumentNotNullOrEmptyString ( destinationSpec , " destinationSpec" ) ;
197
329
198
330
Push ( remote , string . Format ( CultureInfo . InvariantCulture ,
199
331
"{0}:{1}" , objectish , destinationSpec ) , pushOptions ) ;
200
332
}
201
333
334
+ /// <summary>
335
+ /// Push specified reference to the <see cref="Remote"/>.
336
+ /// </summary>
337
+ /// <param name="remote">The <see cref="Remote"/> to push to.</param>
338
+ /// <param name="pushRefSpec">The pushRefSpec to push.</param>
339
+ public virtual void Push (
340
+ Remote remote ,
341
+ string pushRefSpec )
342
+ {
343
+ Ensure . ArgumentNotNullOrEmptyString ( pushRefSpec , "pushRefSpec" ) ;
344
+
345
+ Push ( remote , new [ ] { pushRefSpec } ) ;
346
+ }
202
347
/// <summary>
203
348
/// Push specified reference to the <see cref="Remote"/>.
204
349
/// </summary>
@@ -208,14 +353,25 @@ public virtual void Push(
208
353
public virtual void Push (
209
354
Remote remote ,
210
355
string pushRefSpec ,
211
- PushOptions pushOptions = null )
356
+ PushOptions pushOptions )
212
357
{
213
- Ensure . ArgumentNotNull ( remote , "remote" ) ;
214
358
Ensure . ArgumentNotNullOrEmptyString ( pushRefSpec , "pushRefSpec" ) ;
215
359
216
360
Push ( remote , new [ ] { pushRefSpec } , pushOptions ) ;
217
361
}
218
362
363
+ /// <summary>
364
+ /// Push specified references to the <see cref="Remote"/>.
365
+ /// </summary>
366
+ /// <param name="remote">The <see cref="Remote"/> to push to.</param>
367
+ /// <param name="pushRefSpecs">The pushRefSpecs to push.</param>
368
+ public virtual void Push (
369
+ Remote remote ,
370
+ IEnumerable < string > pushRefSpecs )
371
+ {
372
+ Push ( remote , pushRefSpecs , null ) ;
373
+ }
374
+
219
375
/// <summary>
220
376
/// Push specified references to the <see cref="Remote"/>.
221
377
/// </summary>
@@ -225,7 +381,7 @@ public virtual void Push(
225
381
public virtual void Push (
226
382
Remote remote ,
227
383
IEnumerable < string > pushRefSpecs ,
228
- PushOptions pushOptions = null )
384
+ PushOptions pushOptions )
229
385
{
230
386
Ensure . ArgumentNotNull ( remote , "remote" ) ;
231
387
Ensure . ArgumentNotNull ( pushRefSpecs , "pushRefSpecs" ) ;
@@ -276,7 +432,7 @@ public virtual MergeResult Pull(Signature merger, PullOptions options)
276
432
277
433
Branch currentBranch = repository . Head ;
278
434
279
- if ( ! currentBranch . IsTracking )
435
+ if ( ! currentBranch . IsTracking )
280
436
{
281
437
throw new LibGit2SharpException ( "There is no tracking information for the current branch." ) ;
282
438
}
0 commit comments