Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a897011

Browse files
shiftkeynulltoken
authored andcommitted
Drop optional parameters in Repository.cs
1 parent 14b3c1a commit a897011

File tree

1 file changed

+43
-4
lines changed

1 file changed

+43
-4
lines changed

LibGit2Sharp/Repository.cs

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,18 @@ public sealed class Repository : IRepository
3737
private readonly Lazy<PathCase> pathCase;
3838

3939
/// <summary>
40-
/// Initializes a new instance of the <see cref="Repository"/> class, providing ooptional behavioral overrides through <paramref name="options"/> parameter.
40+
/// Initializes a new instance of the <see cref="Repository"/> class.
41+
/// <para>For a standard repository, <paramref name="path"/> should either point to the ".git" folder or to the working directory. For a bare repository, <paramref name="path"/> should directly point to the repository folder.</para>
42+
/// </summary>
43+
/// <param name="path">
44+
/// The path to the git repository to open, can be either the path to the git directory (for non-bare repositories this
45+
/// would be the ".git" folder inside the working directory) or the path to the working directory.
46+
/// </param>
47+
public Repository(string path) : this(path, null)
48+
{ }
49+
50+
/// <summary>
51+
/// Initializes a new instance of the <see cref="Repository"/> class, providing optional behavioral overrides through <paramref name="options"/> parameter.
4152
/// <para>For a standard repository, <paramref name="path"/> should either point to the ".git" folder or to the working directory. For a bare repository, <paramref name="path"/> should directly point to the repository folder.</para>
4253
/// </summary>
4354
/// <param name="path">
@@ -47,7 +58,7 @@ public sealed class Repository : IRepository
4758
/// <param name="options">
4859
/// Overrides to the way a repository is opened.
4960
/// </param>
50-
public Repository(string path, RepositoryOptions options = null)
61+
public Repository(string path, RepositoryOptions options)
5162
{
5263
Ensure.ArgumentNotNullOrEmptyString(path, "path");
5364

@@ -365,13 +376,23 @@ private void Dispose(bool disposing)
365376

366377
#endregion
367378

379+
/// <summary>
380+
/// Initialize a repository at the specified <paramref name="path"/>.
381+
/// </summary>
382+
/// <param name="path">The path to the working folder when initializing a standard ".git" repository. Otherwise, when initializing a bare repository, the path to the expected location of this later.</param>
383+
/// <returns>The path to the created repository.</returns>
384+
public static string Init(string path)
385+
{
386+
return Init(path, false);
387+
}
388+
368389
/// <summary>
369390
/// Initialize a repository at the specified <paramref name="path"/>.
370391
/// </summary>
371392
/// <param name="path">The path to the working folder when initializing a standard ".git" repository. Otherwise, when initializing a bare repository, the path to the expected location of this later.</param>
372393
/// <param name="isBare">true to initialize a bare repository. False otherwise, to initialize a standard ".git" repository.</param>
373394
/// <returns>The path to the created repository.</returns>
374-
public static string Init(string path, bool isBare = false)
395+
public static string Init(string path, bool isBare)
375396
{
376397
Ensure.ArgumentNotNullOrEmptyString(path, "path");
377398

@@ -542,6 +563,24 @@ public static string Discover(string startingPath)
542563
return discoveredPath.Native;
543564
}
544565

566+
/// <summary>
567+
/// Clone using default options.
568+
/// </summary>
569+
/// <exception cref="RecurseSubmodulesException">This exception is thrown when there
570+
/// is an error is encountered while recursively cloning submodules. The inner exception
571+
/// will contain the original exception. The initially cloned repository would
572+
/// be reported through the <see cref="RecurseSubmodulesException.InitialRepositoryPath"/>
573+
/// property.</exception>"
574+
/// <exception cref="UserCancelledException">Exception thrown when the cancelling
575+
/// the clone of the initial repository.</exception>"
576+
/// <param name="sourceUrl">URI for the remote repository</param>
577+
/// <param name="workdirPath">Local path to clone into</param>
578+
/// <returns>The path to the created repository.</returns>
579+
public static string Clone(string sourceUrl, string workdirPath)
580+
{
581+
return Clone(sourceUrl, workdirPath, null);
582+
}
583+
545584
/// <summary>
546585
/// Clone with specified options.
547586
/// </summary>
@@ -557,7 +596,7 @@ public static string Discover(string startingPath)
557596
/// <param name="options"><see cref="CloneOptions"/> controlling clone behavior</param>
558597
/// <returns>The path to the created repository.</returns>
559598
public static string Clone(string sourceUrl, string workdirPath,
560-
CloneOptions options = null)
599+
CloneOptions options)
561600
{
562601
Ensure.ArgumentNotNull(sourceUrl, "sourceUrl");
563602
Ensure.ArgumentNotNull(workdirPath, "workdirPath");

0 commit comments

Comments
 (0)