8000 Remove optional parameters from IRepository · GiTechLab/libgit2sharp@b8225a7 · GitHub
[go: up one dir, main page]

Skip to content

Commit b8225a7

Browse files
JPaulDuncannulltoken
authored andcommitted
Remove optional parameters from IRepository
Fix libgit2#779
1 parent a4a4436 commit b8225a7

File tree

3 files changed

+208
-29
lines changed

3 files changed

+208
-29
lines changed

LibGit2Sharp/IRepository.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public interface IRepository : IDisposable
8181
/// <param name="options"><see cref="CheckoutOptions"/> controlling checkout behavior.</param>
8282
/// <param name="signature">Identity for use when updating the reflog.</param>
8383
/// <returns>The <see cref="Branch"/> that was checked out.</returns>
84-
Branch Checkout(Branch branch, CheckoutOptions options, Signature signature = null);
84+
Branch Checkout(Branch branch, CheckoutOptions options, Signature signature);
8585

8686
/// <summary>
8787
/// Checkout the specified branch, reference or SHA.
@@ -94,7 +94,7 @@ public interface IRepository : IDisposable
9494
/// <param name="options"><see cref="CheckoutOptions"/> controlling checkout behavior.</param>
9595
/// <param name="signature">Identity for use when updating the reflog.</param>
9696
/// <returns>The <see cref="Branch"/> that was checked out.</returns>
97-
Branch Checkout(string committishOrBranchSpec, CheckoutOptions options, Signature signature = null);
97+
Branch Checkout(string committishOrBranchSpec, CheckoutOptions options, Signature signature);
9898

9999
/// <summary>
100100
/// Checkout the specified <see cref="LibGit2Sharp.Commit"/>.
@@ -106,7 +106,7 @@ public interface IRepository : IDisposable
106106
/// <param name="options"><see cref="CheckoutOptions"/> controlling checkout behavior.</param>
107107
/// <param name="signature">Identity for use when updating the reflog.</param>
108108
/// <returns>The <see cref="Branch"/> that was checked out.</returns>
109-
Branch Checkout(Commit commit, CheckoutOptions options, Signature signature = null);
109+
Branch Checkout(Commit commit, CheckoutOptions options, Signature signature);
110110

111111
/// <summary>
112112
/// Updates specifed paths in the index and working directory with the versions from the specified branch, reference, or SHA.
@@ -117,7 +117,7 @@ public interface IRepository : IDisposable
117117
/// <param name = "committishOrBranchSpec">A revparse spec for the commit or branch to checkout paths from.</param>
118118
/// <param name="paths">The paths to checkout.</param>
119119
/// <param name="checkoutOptions">Collection of parameters controlling checkout behavior.</param>
120-
void CheckoutPaths(string committishOrBranchSpec, IEnumerable<string> paths, CheckoutOptions checkoutOptions = null);
120+
void CheckoutPaths(string committishOrBranchSpec, IEnumerable<string> paths, CheckoutOptions checkoutOptions);
121121

122122
/// <summary>
123123
/// Try to lookup an object by its <see cref="ObjectId"/>. If no matching object is found, null will be returned.
@@ -159,7 +159,7 @@ public interface IRepository : IDisposable
159159
/// <param name="committer">The <see cref="Signature"/> of who added the change to the repository.</param>
160160
/// <param name="options">The <see cref="CommitOptions"/> that specify the commit behavior.</param>
161161
/// <returns>The generated <see cref="LibGit2Sharp.Commit"/>.</returns>
162-
Commit Commit(string message, Signature author, Signature committer, CommitOptions options = null);
162+
Commit Commit(string message, Signature author, Signature committer, CommitOptions options);
163163

164164
/// <summary>
165165
/// Sets the current <see cref="Head"/> to the specified commit and optionally resets the <see cref="Index"/> and
@@ -169,7 +169,7 @@ public interface IRepository : IDisposable
169169
/// <param name="commit">The target commit object.</param>
170170
/// <p B41A aram name="signature">Identity for use when updating the reflog.</param>
171171
/// <param name="logMessage">Message to use when updating the reflog.</param>
172-
void Reset(ResetMode resetMode, Commit commit, Signature signature = null, string logMessage = null);
172+
void Reset(ResetMode resetMode, Commit commit, Signature signature, string logMessage);
173173

174174
/// <summary>
175175
/// Replaces entries in the <see cref="Repository.Index"/> with entries from the specified commit.
@@ -180,7 +180,7 @@ public interface IRepository : IDisposable
180180
/// If set, the passed <paramref name="paths"/> will be treated as explicit paths.
181181
/// Use these options to determine how unmatched explicit paths should be handled.
182182
/// </param>
183-
void Reset(Commit commit, IEnumerable<string> paths = null, ExplicitPathsOptions explicitPathsOptions = null);
183+
void Reset(Commit commit, IEnumerable<string> paths, ExplicitPathsOptions explicitPathsOptions);
184184

185185
/// <summary>
186186
/// Clean the working tree by removing files that are not under version control.
@@ -194,7 +194,7 @@ public interface IRepository : IDisposable
194194
/// <param name="reverter">The <see cref="Signature"/> of who is performing the reverte.</param>
195195
/// <param name="options"><see cref="RevertOptions"/> controlling revert behavior.</param>
196196
/// <returns>The result of the revert.</returns>
197-
RevertResult Revert(Commit commit, Signature reverter, RevertOptions options = null);
197+
RevertResult Revert(Commit commit, Signature reverter, RevertOptions options);
198198

199199
/// <summary>
200200
/// Merge changes from commit into the branch pointed at by HEAD..
@@ -203,7 +203,7 @@ public interface IRepository : IDisposable
203203
/// <param name="merger">The <see cref="Signature"/> of who is performing the merge.</param>
204204
/// <param name="options">Specifies optional parameters controlling merge behavior; if null, the defaults are used.</param>
205205
/// <returns>The <see cref="MergeResult"/> of the merge.</returns>
206-
MergeResult Merge(Commit commit, Signature merger, MergeOptions options = null);
206+
MergeResult Merge(Commit commit, Signature merger, MergeOptions options);
207207

208208
/// <summary>
209209
/// Merges changes from branch into the branch pointed at by HEAD..
@@ -212,7 +212,7 @@ public interface IRepository : IDisposable
212212
/// <param name="merger">The <see cref="Signature"/> of who is performing the merge.</param>
213213
/// <param name="options">Specifies optional parameters controlling merge behavior; if null, the defaults are used.</param>
214214
/// <returns>The <see cref="MergeResult"/> of the merge.</returns>
215-
MergeResult Merge(Branch branch, Signature merger, MergeOptions options = null);
215+
MergeResult Merge(Branch branch, Signature merger, MergeOptions options);
216216

217217
/// <summary>
218218
/// Merges changes from the commit into the branch pointed at by HEAD.
@@ -221,7 +221,7 @@ public interface IRepository : IDisposable
221221
/// <param name="merger">The <see cref="Signature"/> of who is performing the merge.</param>
222222
/// <param name="options">Specifies optional parameters controlling merge behavior; if null, the defaults are used.</param>
223223
/// <returns>The <see cref="MergeResult"/> of the merge.</returns>
224-
MergeResult Merge(string committish, Signature merger, MergeOptions options = null);
224+
MergeResult Merge(string committish, Signature merger, MergeOptions options);
225225

226226
/// <summary>
227227
/// Cherry picks changes from the commit into the branch pointed at by HEAD.
@@ -230,7 +230,7 @@ public interface IRepository : IDisposable
230230
/// <param name="committer">The <see cref="Signature"/> of who is performing the cherry pick.</param>
231231
/// <param name="options">Specifies optional parameters controlling cherry pick behavior; if null, the defaults are used.</param>
232232
/// <returns>The <see cref="MergeResult"/> of the merge.</returns>
233-
CherryPickResult CherryPick(Commit commit, Signature committer, CherryPickOptions options = null);
233+
CherryPickResult CherryPick(Commit commit, Signature committer, CherryPickOptions options);
234234

235235
/// <summary>
236236
/// Manipulate the currently ignored files.
@@ -253,6 +253,6 @@ public interface IRepository : IDisposable
253253
/// <param name="path">Path of the file to blame.</param>
254254
/// <param name="options">Specifies optional parameters; if null, the defaults are used.</param>
255255
/// <returns>The blame for the file.</returns>
256-
BlameHunkCollection Blame(string path, BlameOptions options = null);
256+
BlameHunkCollection Blame(string path, BlameOptions options);
257257
}
258258
}

LibGit2Sharp/Repository.cs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ public static string Clone(string sourceUrl, string workdirPath,
572572
/// <param name="path">Path of the file to blame.</param>
573573
/// <param name="options">Specifies optional parameters; if null, the defaults are used.</param>
574574
/// <returns>The blame for the file.</returns>
575-
public BlameHunkCollection Blame(string path, BlameOptions options = null)
575+
public BlameHunkCollection Blame(string path, BlameOptions options)
576576
{
577577
return new BlameHunkCollection(this, Handle, path, options ?? new BlameOptions());
578578
}
@@ -588,7 +588,7 @@ public BlameHunkCollection Blame(string path, BlameOptions options = null)
588588
/// <param name="options"><see cref="CheckoutOptions"/> controlling checkout behavior.</param>
589589
/// <param name="signature">Identity for use when updating the reflog.</param>
590590
/// <returns>The <see cref="Branch"/> that was checked out.</returns>
591-
public Branch Checkout(string committishOrBranchSpec, CheckoutOptions options, Signature signature = null)
591+
public Branch Checkout(string committishOrBranchSpec, CheckoutOptions options, Signature signature)
592592
{
593593
Ensure.ArgumentNotNullOrEmptyString(committishOrBranchSpec, "committishOrBranchSpec");
594594
Ensure.ArgumentNotNull(options, "options");
@@ -638,7 +638,7 @@ public Branch Checkout(string committishOrBranchSpec, CheckoutOptions options, S
638638
/// <param name="options"><see cref="CheckoutOptions"/> controlling checkout behavior.</param>
639639
/// <param name="signature">Identity for use when updating the reflog.</param>
640640
/// <returns>The <see cref="Branch"/> that was checked out.</returns>
641-
public Branch Checkout(Branch branch, CheckoutOptions options, Signature signature = null)
641+
public Branch Checkout(Branch branch, CheckoutOptions options, Signature signature)
642642
{
643643
Ensure.ArgumentNotNull(branch, "branch");
644644
Ensure.ArgumentNotNull(options, "options");
@@ -675,7 +675,7 @@ public Branch Checkout(Branch branch, CheckoutOptions options, Signature signatu
675675
/// <param name="options"><see cref="CheckoutOptions"/> controlling checkout behavior.</param>
676676
/// <param name="signature">Identity for use when updating the reflog.</param>
677677
/// <returns>The <see cref="Branch"/> that was checked out.</returns>
678-
public Branch Checkout(Commit commit, CheckoutOptions options, Signature signature = null)
678+
public Branch Checkout(Commit commit, CheckoutOptions options, Signature signature)
679679
{
680680
Ensure.ArgumentNotNull(commit, "commit");
681681
Ensure.ArgumentNotNull(options, "options");
@@ -736,7 +736,7 @@ private void CheckoutTree(
736736
/// <param name="commit">The target commit object.</param>
737737
/// <param name="signature">Identity for use when updating the reflog.</param>
738738
/// <param name="logMessage">Message to use when updating the reflog.</param>
739-
public void Reset(ResetMode resetMode, Commit commit, Signature signature = null, string logMessage = null)
739+
public void Reset(ResetMode resetMode, Commit commit, Signature signature, string logMessage)
740740
{
741741
Ensure.ArgumentNotNull(commit, "commit");
742742

@@ -759,7 +759,7 @@ public void Reset(ResetMode resetMode, Commit commit, Signature signature = null
759759
/// <param name = "committishOrBranchSpec">A revparse spec for the commit or branch to checkout paths from.</param>
760760
/// <param name="paths">The paths to checkout. Will throw if null is passed in. Passing an empty enumeration results in nothing being checked out.</param>
761761
/// <param name="checkoutOptions">Collection of parameters controlling checkout behavior.</param>
762-
public void CheckoutPaths(string committishOrBranchSpec, IEnumerable<string> paths, CheckoutOptions checkoutOptions = null)
762+
public void CheckoutPaths(string committishOrBranchSpec, IEnumerable<string> paths, CheckoutOptions checkoutOptions)
763763
{
764764
Ensure.ArgumentNotNullOrEmptyString(committishOrBranchSpec, "committishOrBranchSpec");
765765
Ensure.ArgumentNotNull(paths, "paths");
@@ -783,7 +783,7 @@ public void CheckoutPaths(string committishOrBranchSpec, IEnumerable<string> pat
783783
/// If set, the passed <paramref name="paths"/> will be treated as explicit paths.
784784
/// Use these options to determine how unmatched explicit paths should be handled.
785785
/// </param>
786-
public void Reset(Commit commit, IEnumerable<string> paths = null, ExplicitPathsOptions explicitPathsOptions = null)
786+
public void Reset(Commit commit, IEnumerable<string> paths, ExplicitPathsOptions explicitPathsOptions)
787787
{
788788
if (Info.IsBare)
789789
{
@@ -806,7 +806,7 @@ public void Reset(Commit commit, IEnumerable<string> paths = null, ExplicitPaths
806806
/// <param name="committer">The <see cref="Signature"/> of who added the change to the repository.</param>
807807
/// <param name="options">The <see cref="CommitOptions"/> that specify the commit behavior.</param>
808808
/// <returns>The generated <see cref="LibGit2Sharp.Commit"/>.</returns>
809-
public Commit Commit(string message, Signature author, Signature committer, CommitOptions options = null)
809+
public Commit Commit(string message, Signature author, Signature committer, CommitOptions options)
810810
{
811811
if (options == null)
812812
{
@@ -992,7 +992,7 @@ private static string ReadContentFromResource(Assembly assembly, string partialR
992992
/// <param name="merger">The <see cref="Signature"/> of who is performing the merge.</param>
993993
/// <param name="options">Specifies optional parameters controlling merge behavior; if null, the defaults are used.</param>
994994
/// <returns>The <see cref="MergeResult"/> of the merge.</returns>
995-
public MergeResult Merge(Commit commit, Signature merger, MergeOptions options = null)
995+
public MergeResult Merge(Commit commit, Signature merger, MergeOptions options)
996996
{
997997
Ensure.ArgumentNotNull(commit, "commit");
998998
Ensure.ArgumentNotNull(merger, "merger");
@@ -1012,7 +1012,7 @@ public MergeResult Merge(Commit commit, Signature merger, MergeOptions options =
10121012
/// <param name="merger">The <see cref="Signature"/> of who is performing the merge.</param>
10131013
/// <param name="options">Specifies optional parameters controlling merge behavior; if null, the defaults are used.</param>
10141014
/// <returns>The <see cref="MergeResult"/> of the merge.</returns>
1015-
public MergeResult Merge(Branch branch, Signature merger, MergeOptions options = null)
1015+
public MergeResult Merge(Branch branch, Signature merger, MergeOptions options)
10161016
{
10171017
Ensure.ArgumentNotNull(branch, "branch");
10181018
Ensure.ArgumentNotNull(merger, "merger");
@@ -1033,7 +1033,7 @@ public MergeResult Merge(Branch branch, Signature merger, MergeOptions options =
10331033
/// <param name="merger">The <see cref="Signature"/> of who is performing the merge.</param>
10341034
/// <param name="options">Specifies optional parameters controlling merge behavior; if null, the defaults are used.</param>
10351035
/// <returns>The <see cref="MergeResult"/> of the merge.</returns>
1036-
public MergeResult Merge(string committish, Signature merger, MergeOptions options = null)
1036+
public MergeResult Merge(string committish, Signature merger, MergeOptions options)
10371037
{
10381038
Ensure.ArgumentNotNull(committish, "committish");
10391039
Ensure.ArgumentNotNull(merger, "merger");
@@ -1097,7 +1097,7 @@ internal MergeResult MergeFetchHeads(Signature merger, MergeOptions options)
10971097
/// <param name="reverter">The <see cref="Signature"/> of who is performing the revert.</param>
10981098
/// <param name="options"><see cref="RevertOptions"/> controlling revert behavior.</param>
10991099
/// <returns>The result of the revert.</returns>
1100-
public RevertResult Revert(Commit commit, Signature reverter, RevertOptions options = null)
1100+
public RevertResult Revert(Commit commit, Signature reverter, RevertOptions options)
11011101
{
11021102
Ensure.ArgumentNotNull(commit, "commit");
11031103
Ensure.ArgumentNotNull(reverter, "reverter");
@@ -1163,7 +1163,8 @@ public RevertResult Revert(Commit commit, Signature reverter, RevertOptions opti
11631163
revertCommit = this.Commit(
11641164
Info.Message,
11651165
author: reverter,
1166-
committer: reverter);
1166+
committer: reverter,
1167+
options: null);
11671168
}
11681169
}
11691170

@@ -1185,7 +1186,7 @@ public RevertResult Revert(Commit commit, Signature reverter, RevertOptions opti
11851186
/// <param name="committer">The <see cref="Signature"/> of who is performing the cherry pick.</param>
11861187
/// <param name="options"><see cref="CherryPickOptions"/> controlling cherry pick behavior.</param>
11871188
/// <returns>The result of the cherry pick.</returns>
1188-
public CherryPickResult CherryPick(Commit commit, Signature committer, CherryPickOptions options = null)
1189+
public CherryPickResult CherryPick(Commit commit, Signature committer, CherryPickOptions options)
11891190
{
11901191
Ensure.ArgumentNotNull(commit, "commit");
11911192
Ensure.ArgumentNotNull(committer, "committer");
@@ -1221,7 +1222,7 @@ public CherryPickResult CherryPick(Commit commit, Signature committer, CherryPic
12211222
Commit cherryPickCommit = null;
12221223
if (options.CommitOnSuccess)
12231224
{
1224-
cherryPickCommit = this.Commit(Info.Message, commit.Author, committer);
1225+
cherryPickCommit = this.Commit(Info.Message, commit.Author, committer, null);
12251226
}
12261227

12271228
result = new CherryPickResult(CherryPickStatus.CherryPicked, cherryPickCommit);
@@ -1364,7 +1365,7 @@ private MergeResult NormalMerge(GitMergeHeadHandle[] mergeHeads, Signature merge
13641365
if (options.CommitOnSuccess)
13651366
{
13661367
// Commit the merge
1367-
mergeCommit = Commit(Info.Message, author: merger, committer: merger);
1368+
mergeCommit = Commit(Info.Message, author: merger, committer: merger, options: null);
13681369
}
13691370

13701371
mergeResult = new MergeResult(MergeStatus.NonFastForward, mergeCommit);

0 commit comments

Comments
 (0)
0