Skip to content

Commit b3386c9

Browse files
shiftkeynulltoken
authored andcommitted
Drop optional parameters in BranchCollectionExtensions.cs
1 parent d7e8a2e commit b3386c9

File tree

1 file changed

+36
-3
lines changed

1 file changed

+36
-3
lines changed

LibGit2Sharp/BranchCollectionExtensions.cs

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ namespace LibGit2Sharp
77
/// </summary>
88
public static class BranchCollectionExtensions
99
{
10+
/// <summary>
11+
/// Create a new local branch with the specified name
12+
/// </summary>
13+
/// <param name="branches">The <see cref="BranchCollection"/> being worked with.</param>
14+
/// <param name="name">The name of the branch.</param>
15+
/// <param name="commit">The target commit.</param>
16+
/// <returns>A new <see cref="Branch"/>.</returns>
17+
public static Branch Add(this BranchCollection branches, string name, Commit commit)
18+
{
19+
return branches.Add(name, commit, false);
20+
}
21+
1022
/// <summary>
1123
/// Create a new local branch with the specified name
1224
/// </summary>
@@ -15,21 +27,30 @@ public static class BranchCollectionExtensions
1527
/// <param name="commit">The target commit.</param>
1628
/// <param name="allowOverwrite">True to allow silent overwriting a potentially existing branch, false otherwise.</param>
1729
/// <returns>A new <see cref="Branch"/>.</returns>
18-
public static Branch Add(this BranchCollection branches, string name, Commit commit, bool allowOverwrite = false)
30+
public static Branch Add(this BranchCollection branches, string name, Commit commit, bool allowOverwrite)
1931
{
2032
Ensure.ArgumentNotNull(commit, "commit");
2133

2234
return branches.Add(name, commit.Sha, allowOverwrite);
2335
}
2436

37+
/// <summary>
38+
/// Deletes the branch with the specified name.
39+
/// </summary>
40+
/// <param name="name">The name of the branch to delete.</param>
41+
/// <param name="branches">The <see cref="BranchCollection"/> being worked with.</param>
42+
public static void Remove(this BranchCollection branches, string name)
43+
{
44+
branches.Remove(name, false);
45+
}
2546

2647
/// <summary>
2748
/// Deletes the branch with the specified name.
2849
/// </summary>
2950
/// <param name="name">The name of the branch to delete.</param>
3051
/// <param name="isRemote">True if the provided <paramref name="name"/> is the name of a remote branch, false otherwise.</param>
3152
/// <param name="branches">The <see cref="BranchCollection"/> being worked with.</param>
32-
public static void Remove(this BranchCollection branches, string name, bool isRemote = false)
53+
public static void Remove(this BranchCollection branches, string name, bool isRemote)
3354
{
3455
Ensure.ArgumentNotNullOrEmptyString(name, "name");
3556

@@ -45,6 +66,18 @@ public static void Remove(this BranchCollection branches, string name, bool isRe
4566
branches.Remove(branch);
4667
}
4768

69+
/// <summary>
70+
/// Rename an existing local branch, using the default reflog message
71+
/// </summary>
72+
/// <param name="currentName">The current branch name.</param>
73+
/// <param name="newName">The new name the existing branch should bear.</param>
74+
/// <param name="branches">The <see cref="BranchCollection"/> being worked with.</param>
75+
/// <returns>A new <see cref="Branch"/>.</returns>
76+
public static Branch Rename(this BranchCollection branches, string currentName, string newName)
77+
{
78+
return branches.Rename(currentName, newName, false);
79+
}
80+
4881
/// <summary>
4982
/// Rename an existing local branch, using the default reflog message
5083
/// </summary>
@@ -53,7 +86,7 @@ public static void Remove(this BranchCollection branches, string name, bool isRe
5386
/// <param name="allowOverwrite">True to allow silent overwriting a potentially existing branch, false otherwise.</param>
5487
/// <param name="branches">The <see cref="BranchCollection"/> being worked with.</param>
5588
/// <returns>A new <see cref="Branch"/>.</returns>
56-
public static Branch Rename(this BranchCollection branches, string currentName, string newName, bool allowOverwrite = false)
89+
public static Branch Rename(this BranchCollection branches, string currentName, string newName, bool allowOverwrite)
5790
{
5891
Ensure.ArgumentNotNullOrEmptyString(currentName, "currentName");
5992
Ensure.ArgumentNotNullOrEmptyString(newName, "newName");

0 commit comments

Comments
 (0)