Skip to content

Commit 747bfc6

Browse files
committed
Remove property setters since options are initialized
1 parent 7bf2e3b commit 747bfc6

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

LibGit2Sharp.Tests/CloneFixture.cs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -567,10 +567,8 @@ public void CannotCloneWithForbiddenCustomHeaders()
567567
const string url = "https://github.com/libgit2/TestGitRepository";
568568

569569
const string knownHeader = "User-Agent: mygit-201";
570-
var cloneOptions = new CloneOptions()
571-
{
572-
FetchOptions = new FetchOptions { CustomHeaders = new String[] { knownHeader } }
573-
};
570+
var cloneOptions = new CloneOptions();
571+
cloneOptions.FetchOptions.CustomHeaders = new string[] { knownHeader };
574572

575573
Assert.Throws<LibGit2SharpException>(() => Repository.Clone(url, scd.DirectoryPath, cloneOptions));
576574
}
@@ -583,10 +581,8 @@ public void CannotCloneWithMalformedCustomHeaders()
583581
const string url = "https://github.com/libgit2/TestGitRepository";
584582

585583
const string knownHeader = "hello world";
586-
var cloneOptions = new CloneOptions()
587-
{
588-
FetchOptions = new FetchOptions { CustomHeaders = new String[] { knownHeader } }
589-
};
584+
var cloneOptions = new CloneOptions();
585+
cloneOptions.FetchOptions.CustomHeaders = new string[] { knownHeader };
590586

591587
Assert.Throws<LibGit2SharpException>(() => Repository.Clone(url, scd.DirectoryPath, cloneOptions));
592588
}
@@ -599,10 +595,8 @@ public void CanCloneWithCustomHeaders()
599595
const string url = "https://github.com/libgit2/TestGitRepository";
600596

601597
const string knownHeader = "X-Hello: world";
602-
var cloneOptions = new CloneOptions()
603-
{
604-
FetchOptions = new FetchOptions { CustomHeaders = new String[] { knownHeader } }
605-
};
598+
var cloneOptions = new CloneOptions();
599+
cloneOptions.FetchOptions.CustomHeaders = new string[] { knownHeader };
606600

607601
var clonedRepoPath = Repository.Clone(url, scd.DirectoryPath, cloneOptions);
608602
Assert.True(Directory.Exists(clonedRepoPath));

LibGit2Sharp/CloneOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public CloneOptions()
4646
/// <summary>
4747
/// Gets or sets the fetch options.
4848
/// </summary>
49-
public FetchOptions FetchOptions { get; set; } = new();
49+
public FetchOptions FetchOptions { get; } = new();
5050

5151
#region IConvertableToGitCheckoutOpts
5252

LibGit2Sharp/FetchOptionsBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ internal FetchOptionsBase()
4949
/// </summary>
5050
public RepositoryOperationCompleted RepositoryOperationCompleted { get; set; }
5151

52-
public ProxyOptions ProxyOptions { get; set; } = new();
52+
public ProxyOptions ProxyOptions { get; } = new();
5353
}
5454
}

0 commit comments

Comments
 (0)