@@ -7,6 +7,18 @@ namespace LibGit2Sharp
7
7
/// </summary>
8
8
public static class BranchCollectionExtensions
9
9
{
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
+
10
22
/// <summary>
11
23
/// Create a new local branch with the specified name
12
24
/// </summary>
@@ -15,21 +27,30 @@ public static class BranchCollectionExtensions
15
27
/// <param name="commit">The target commit.</param>
16
28
/// <param name="allowOverwrite">True to allow silent overwriting a potentially existing branch, false otherwise.</param>
17
29
/// <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 )
19
31
{
20
32
Ensure . ArgumentNotNull ( commit , "commit" ) ;
21
33
22
34
return branches . Add ( name , commit . Sha , allowOverwrite ) ;
23
35
}
24
36
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
+ }
25
46
26
47
/// <summary>
27
48
/// Deletes the branch with the specified name.
28
49
/// </summary>
29
50
/// <param name="name">The name of the branch to delete.</param>
30
51
/// <param name="isRemote">True if the provided <paramref name="name"/> is the name of a remote branch, false otherwise.</param>
31
52
/// <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 )
33
54
{
34
55
Ensure . ArgumentNotNullOrEmptyString ( name , "name" ) ;
35
56
@@ -45,6 +66,18 @@ public static void Remove(this BranchCollection branches, string name, bool isRe
45
66
branches . Remove ( branch ) ;
46
67
}
47
68
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
+
48
81
/// <summary>
49
82
/// Rename an existing local branch, using the default reflog message
50
83
/// </summary>
@@ -53,7 +86,7 @@ public static void Remove(this BranchCollection branches, string name, bool isRe
53
86
/// <param name="allowOverwrite">True to allow silent overwriting a potentially existing branch, false otherwise.</param>
54
87
/// <param name="branches">The <see cref="BranchCollection"/> being worked with.</param>
55
88
/// <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 )
57
90
{
58
91
Ensure . ArgumentNotNullOrEmptyString ( currentName , "currentName" ) ;
59
92
Ensure . ArgumentNotNullOrEmptyString ( newName , "newName" ) ;
0 commit comments