@@ -482,7 +482,7 @@ private void Dispose(bool disposing)
482
482
/// <returns>The path to the created repository.</returns>
483
483
public static string Init ( string path )
484
484
{
485
- return Init ( path , false ) ;
485
+ return Init ( path , false , new InitOptions ( ) ) ;
486
486
}
487
487
488
488
/// <summary>
@@ -492,10 +492,34 @@ public static string Init(string path)
492
492
/// <param name="isBare">true to initialize a bare repository. False otherwise, to initialize a standard ".git" repository.</param>
493
493
/// <returns>The path to the created repository.</returns>
494
494
public static string Init ( string path , bool isBare )
495
+ {
496
+ return Init ( path , isBare , new InitOptions ( ) ) ;
497
+ }
498
+
499
+
500
+ /// <summary>
501
+ /// Initialize a repository by explictly setting the path to both the working directory and the git directory.
502
+ /// </summary>
503
+ /// <param name="workingDirectoryPath">The path to the working directory.</param>
504
+ /// <param name="gitDirectoryPath">The path to the git repository to be created.</param>
505
+ /// <returns>The path to the created repository.</returns>
506
+ public static string Init ( string workingDirectoryPath , string gitDirectoryPath )
507
+ {
508
+ return Init ( workingDirectoryPath , gitDirectoryPath , new InitOptions ( ) ) ;
509
+ }
510
+
511
+ /// <summary>
512
+ /// Initialize a repository at the specified <paramref name="path"/>.
513
+ /// </summary>
514
+ /// <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>
515
+ /// <param name="isBare">true to initialize a bare repository. False otherwise, to initialize a standard ".git" repository.</param>
516
+ /// <param name="options">Additional optional parameters to be passed to the Init invocation</param>
517
+ /// <returns>The path to the created repository.</returns>
518
+ public static string Init ( string path , bool isBare , InitOptions options )
495
519
{
496
520
Ensure . ArgumentNotNullOrEmptyString ( path , "path" ) ;
497
521
498
- using ( RepositoryHandle repo = Proxy . git_repository_init_ext ( null , path , isBare ) )
522
+ using ( RepositoryHandle repo = Proxy . git_repository_init_ext ( null , path , isBare , options . InitialHead ) )
499
523
{
500
524
FilePath repoPath = Proxy . git_repository_path ( repo ) ;
501
525
return repoPath . Native ;
@@ -507,8 +531,9 @@ public static string Init(string path, bool isBare)
507
531
/// </summary>
508
532
/// <param name="workingDirectoryPath">The path to the working directory.</param>
509
533
/// <param name="gitDirectoryPath">The path to the git repository to be created.</param>
534
+ /// <param name="options">Additional optional parameters to be passed to the Init invocation</param>
510
535
/// <returns>The path to the created repository.</returns>
511
- public static string Init ( string workingDirectoryPath , string gitDirectoryPath )
536
+ public static string Init ( string workingDirectoryPath , string gitDirectoryPath , InitOptions options )
512
537
{
513
538
Ensure . ArgumentNotNullOrEmptyString ( workingDirectoryPath , "workingDirectoryPath" ) ;
514
539
Ensure . ArgumentNotNullOrEmptyString ( gitDirectoryPath , "gitDirectoryPath" ) ;
@@ -520,7 +545,7 @@ public static string Init(string workingDirectoryPath, string gitDirectoryPath)
520
545
521
546
// TODO: Shouldn't we ensure that the working folder isn't under the gitDir?
522
547
523
- using ( RepositoryHandle repo = Proxy . git_repository_init_ext ( wd , gitDirectoryPath , false ) )
548
+ using ( RepositoryHandle repo = Proxy . git_repository_init_ext ( wd , gitDirectoryPath , false , options . InitialHead ) )
524
549
{
525
550
FilePath repoPath = Proxy . git_repository_path ( repo ) ;
526
551
return repoPath . Native ;
@@ -1050,7 +1075,7 @@ public Commit Commit(string message, Signature author, Signature committer, Comm
1050
1075
1051
1076
if ( treesame && ! amendMergeCommit )
1052
1077
{
1053
- throw ( options . AmendPreviousCommit ?
1078
+ throw ( options . AmendPreviousCommit ?
1054
1079
new EmptyCommitException ( "Amending this commit would produce a commit that is identical to its parent (id = {0})" , parents [ 0 ] . Id ) :
1055
1080
new EmptyCommitException ( "No changes; nothing to commit." ) ) ;
1056
1081
}
@@ -1241,7 +1266,7 @@ public MergeResult MergeFetchedRefs(Signature merger, MergeOptions options)
1241
1266
if ( fetchHeads . Length == 0 )
1242
1267
{
1243
1268
var expectedRef = this . Head . UpstreamBranchCanonicalName ;
1244
- throw new MergeFetchHeadNotFoundException ( "The current branch is configured to merge with the reference '{0}' from the remote, but this reference was not fetched." ,
1269
+ throw new MergeFetchHeadNotFoundException ( "The current branch is configured to merge with the reference '{0}' from the remote, but this reference was not fetched." ,
1245
1270
expectedRef ) ;
1246
1271
}
1247
1272
0 commit comments