@@ -152,13 +152,24 @@ public static Branch CreateBranch(this IRepository repository, string branchName
152
152
}
153
153
154
154
/// <summary>
155
- /// Sets the current <see cref="Repository.Head"/> to the specified commit and optionally resets the <see cref="Index"/> and
155
+ /// Sets the current <see cref="Repository.Head"/> and resets the <see cref="Index"/> and
156
+ /// the content of the working tree to match.
157
+ /// </summary>
158
+ /// <param name="repository">The <see cref="Repository"/> being worked with.</param>
159
+ /// <param name="resetMode">Flavor of reset operation to perform.</param>
160
+ public static void Reset ( this IRepository repository , ResetMode resetMode )
161
+ {
162
+ repository . Reset ( resetMode , "HEAD" ) ;
163
+ }
164
+
165
+ /// <summary>
166
+ /// Sets the current <see cref="Repository.Head"/> to the specified commitish and optionally resets the <see cref="Index"/> and
156
167
/// the content of the working tree to match.
157
168
/// </summary>
158
169
/// <param name="repository">The <see cref="Repository"/> being worked with.</param>
159
170
/// <param name="resetMode">Flavor of reset operation to perform.</param>
160
171
/// <param name="committish">A revparse spec for the target commit object.</param>
161
- public static void Reset ( this IRepository repository , ResetMode resetMode , string committish = "HEAD" )
172
+ public static void Reset ( this IRepository repository , ResetMode resetMode , string committish )
162
173
{
163
174
Ensure . ArgumentNotNullOrEmptyString ( committish , "committish" ) ;
164
175
@@ -199,6 +210,20 @@ private static Commit LookUpCommit(IRepository repository, string committish)
199
210
return obj . DereferenceToCommit ( true ) ;
200
211
}
201
212
213
+ /// <summary>
214
+ /// Stores the content of the <see cref="Repository.Index"/> as a new <see cref="LibGit2Sharp.Commit"/> into the repository.
215
+ /// The tip of the <see cref="Repository.Head"/> will be used as the parent of this new Commit.
216
+ /// Once the commit is created, the <see cref="Repository.Head"/> will move forward to point at it.
217
+ /// <para>Both the Author and Committer will be guessed from the Git configuration. An exception will be raised if no configuration is reachable.</para>
218
+ /// </summary>
219
+ /// <param name="repository">The <see cref="Repository"/> being worked with.</param>
220
+ /// <param name="message">The description of why a change was made to the repository.</param>
221
+ /// <returns>The generated <see cref="LibGit2Sharp.Commit"/>.</returns>
222
+ public static Commit Commit ( this IRepository repository , string message )
223
+ {
224
+ return repository . Commit ( message , ( CommitOptions ) null ) ;
225
+ }
226
+
202
227
/// <summary>
203
228
/// Stores the content of the <see cref="Repository.Index"/> as a new <see cref="LibGit2Sharp.Commit"/> into the repository.
204
229
/// The tip of the <see cref="Repository.Head"/> will be used as the parent of this new Commit.
@@ -209,13 +234,29 @@ private static Commit LookUpCommit(IRepository repository, string committish)
209
234
/// <param name="message">The description of why a change was made to the repository.</param>
210
235
/// <param name="options">The <see cref="CommitOptions"/> that specify the commit behavior.</param>
211
236
/// <returns>The generated <see cref="LibGit2Sharp.Commit"/>.</returns>
212
- public static Commit Commit ( this IRepository repository , string message , CommitOptions options = null )
237
+ public static Commit Commit ( this IRepository repository , string message , CommitOptions options )
213
238
{
214
239
Signature author = repository . Config . BuildSignature ( DateTimeOffset . Now , true ) ;
215
240
216
241
return repository . Commit ( message , author , options ) ;
217
242
}
218
243
244
+ /// <summary>
245
+ /// Stores the content of the <see cref="Repository.Index"/> as a new <see cref="LibGit2Sharp.Commit"/> into the repository.
246
+ /// The tip of the <see cref="Repository.Head"/> will be used as the parent of this new Commit.
247
+ /// Once the commit is created, the <see cref="Repository.Head"/> will move forward to point at it.
248
+ /// <para>The Committer will be guessed from the Git configuration. An exception will be raised if no configuration is reachable.</para>
249
+ /// </summary>
250
+ /// <param name="repository">The <see cref="Repository"/> being worked with.</param>
251
+ /// <param name="author">The <see cref="Signature"/> of who made the change.</param>
252
+ /// <param name="message">The description of why a change was made to the repository.</param>
253
+ /// <returns>The generated <see cref="LibGit2Sharp.Commit"/>.</returns>
254
+ public static Commit Commit ( this IRepository repository , string message , Signature author )
255
+ {
256
+ return repository . Commit ( message , author , ( CommitOptions ) null ) ;
257
+ }
258
+
259
+
219
260
/// <summary>
220
261
/// Stores the content of the <see cref="Repository.Index"/> as a new <see cref="LibGit2Sharp.Commit"/> into the repository.
221
262
/// The tip of the <see cref="Repository.Head"/> will be used as the parent of this new Commit.
@@ -227,20 +268,30 @@ public static Commit Commit(this IRepository repository, string message, CommitO
227
268
/// <param name="message">The description of why a change was made to the repository.</param>
228
269
/// <param name="options">The <see cref="CommitOptions"/> that specify the commit behavior.</param>
229
270
/// <returns>The generated <see cref="LibGit2Sharp.Commit"/>.</returns>
230
- public static Commit Commit ( this IRepository repository , string message , Signature author , CommitOptions options = null )
271
+ public static Commit Commit ( this IRepository repository , string message , Signature author , CommitOptions options )
231
272
{
232
273
Signature committer = repository . Config . BuildSignature ( DateTimeOffset . Now , true ) ;
233
274
234
275
return repository . Commit ( message , author , committer , options ) ;
235
276
}
236
277
278
+ /// <summary>
279
+ /// Fetch from the specified remote.
280
+ /// </summary>
281
+ /// <param name="repository">The <see cref="Repository"/> being worked with.</param>
282
+ /// <param name="remoteName">The name of the <see cref="Remote"/> to fetch from.</param>
283
+ public static void Fetch ( this IRepository repository , string remoteName )
284
+ {
285
+ repository . Fetch ( remoteName , null ) ;
286
+ }
287
+
237
288
/// <summary>
238
289
/// Fetch from the specified remote.
239
290
/// </summary>
240
291
/// <param name="repository">The <see cref="Repository"/> being worked with.</param>
241
292
/// <param name="remoteName">The name of the <see cref="Remote"/> to fetch from.</param>
242
293
/// <param name="options"><see cref="FetchOptions"/> controlling fetch behavior</param>
243
- public static void Fetch ( this IRepository repository , string remoteName , FetchOptions options = null )
294
+ public static void Fetch ( this IRepository repository , string remoteName , FetchOptions options )
244
295
{
245
296
Ensure . ArgumentNotNull ( repository , "repository" ) ;
246
297
Ensure . ArgumentNotNullOrEmptyString ( remoteName , "remoteName" ) ;
0 commit comments