@@ -46,9 +46,25 @@ public virtual RemoteCollection Remotes
4646 /// </para>
4747 /// </summary>
4848 /// <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>
5049 /// <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 )
5268 {
5369 Ensure . ArgumentNotNull ( remote , "remote" ) ;
5470
@@ -116,14 +132,42 @@ static void DoFetch(RemoteSafeHandle remoteHandle, FetchOptions options, string
116132 Proxy . git_remote_fetch ( remoteHandle , logMessage ) ;
117133 }
118134
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+
119164 /// <summary>
120165 /// Fetch from the <see cref="Remote"/>.
121166 /// </summary>
122167 /// <param name="remote">The remote to fetch</param>
123168 /// <param name="options"><see cref="FetchOptions"/> controlling fetch behavior</param>
124169 /// <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 )
127171 {
128172 Ensure . ArgumentNotNull ( remote , "remote" ) ;
129173
@@ -133,15 +177,46 @@ public virtual void Fetch(Remote remote, FetchOptions options = null,
133177 }
134178 }
135179
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+
136212 /// <summary>
137213 /// Fetch from the <see cref="Remote"/>, using custom refspecs.
138214 /// </summary>
139215 /// <param name="remote">The remote to fetch</param>
140216 /// <param name="refspecs">Refspecs to use, replacing the remote's fetch refspecs</param>
141217 /// <param name="options"><see cref="FetchOptions"/> controlling fetch behavior</param>
142218 /// <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 )
145220 {
146221 Ensure . ArgumentNotNull ( remote , "remote" ) ;
147222 Ensure . ArgumentNotNull ( refspecs , "refspecs" ) ;
@@ -154,6 +229,46 @@ public virtual void Fetch(Remote remote, IEnumerable<string> refspecs, FetchOpti
154229 }
155230 }
156231
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+
157272 /// <summary>
158273 /// Fetch from a url with a set of fetch refspecs
159274 /// </summary>
@@ -164,8 +279,8 @@ public virtual void Fetch(Remote remote, IEnumerable<string> refspecs, FetchOpti
164279 public virtual void Fetch (
165280 string url ,
166281 IEnumerable < string > refspecs ,
167- FetchOptions options = null ,
168- string logMessage = null )
282+ FetchOptions options ,
283+ string logMessage )
169284 {
170285 Ensure . ArgumentNotNull ( url , "url" ) ;
171286 Ensure . ArgumentNotNull ( refspecs , "refspecs" ) ;
@@ -178,6 +293,24 @@ public virtual void Fetch(
178293 }
179294 }
180295
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+
181314 /// <summary>
182315 /// Push the objectish to the destination reference on the <see cref="Remote"/>.
183316 /// </summary>
@@ -189,16 +322,28 @@ public virtual void Push(
189322 Remote remote ,
190323 string objectish ,
191324 string destinationSpec ,
192- PushOptions pushOptions = null )
325+ PushOptions pushOptions )
193326 {
194- Ensure . ArgumentNotNull ( remote , "remote" ) ;
195327 Ensure . ArgumentNotNull ( objectish , "objectish" ) ;
196- Ensure . ArgumentNotNullOrEmptyString ( destinationSpec , destinationSpec ) ;
328+ Ensure . ArgumentNotNullOrEmptyString ( destinationSpec , " destinationSpec" ) ;
197329
198330 Push ( remote , string . Format ( CultureInfo . InvariantCulture ,
199331 "{0}:{1}" , objectish , destinationSpec ) , pushOptions ) ;
200332 }
201333
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+ }
202347 /// <summary>
203348 /// Push specified reference to the <see cref="Remote"/>.
204349 /// </summary>
@@ -208,14 +353,25 @@ public virtual void Push(
208353 public virtual void Push (
209354 Remote remote ,
210355 string pushRefSpec ,
211- PushOptions pushOptions = null )
356+ PushOptions pushOptions )
212357 {
213- Ensure . ArgumentNotNull ( remote , "remote" ) ;
214358 Ensure . ArgumentNotNullOrEmptyString ( pushRefSpec , "pushRefSpec" ) ;
215359
216360 Push ( remote , new [ ] { pushRefSpec } , pushOptions ) ;
217361 }
218362
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+
219375 /// <summary>
220376 /// Push specified references to the <see cref="Remote"/>.
221377 /// </summary>
@@ -225,7 +381,7 @@ public virtual void Push(
225381 public virtual void Push (
226382 Remote remote ,
227383 IEnumerable < string > pushRefSpecs ,
228- PushOptions pushOptions = null )
384+ PushOptions pushOptions )
229385 {
230386 Ensure . ArgumentNotNull ( remote , "remote" ) ;
231387 Ensure . ArgumentNotNull ( pushRefSpecs , "pushRefSpecs" ) ;
@@ -276,7 +432,7 @@ public virtual MergeResult Pull(Signature merger, PullOptions options)
276432
277433 Branch currentBranch = repository . Head ;
278434
279- if ( ! currentBranch . IsTracking )
435+ if ( ! currentBranch . IsTracking )
280436 {
281437 throw new LibGit2SharpException ( "There is no tracking information for the current branch." ) ;
282438 }
0 commit comments