Skip to content

Commit 360d31c

Browse files
committed
Move BranchCollection overloads to Extensions
1 parent 49346f8 commit 360d31c

File tree

2 files changed

+24
-22
lines changed

2 files changed

+24
-22
lines changed

LibGit2Sharp/BranchCollection.cs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,6 @@ IEnumerator IEnumerable.GetEnumerator()
106106

107107
#endregion
108108

109-
/// <summary>
110-
/// Create a new local branch with the specified name
111-
/// </summary>
112-
/// <param name="name">The name of the branch.</param>
113-
/// <param name="committish">Revparse spec for the target commit.</param>
114-
/// <returns>A new <see cref="Branch"/>.</returns>
115-
public virtual Branch Add(string name, string committish)
116-
{
117-
return Add(name, committish, false);
118-
}
119-
120109
/// <summary>
121110
/// Create a new local branch with the specified name
122111
/// </summary>
@@ -149,17 +138,6 @@ public virtual void Remove(Branch branch)
149138
}
150139
}
151140

152-
/// <summary>
153-
/// Rename an existing local branch
154-
/// </summary>
155-
/// <param name="branch">The current local branch.</param>
156-
/// <param name="newName">The new name the existing branch should bear.</param>
157-
/// <returns>A new <see cref="Branch"/>.</returns>
158-
public virtual Branch Rename(Branch branch, string newName)
159-
{
160-
return Rename(branch, newName, false);
161-
}
162-
163141
/// <summary>
164142
/// Rename an existing local branch
165143
/// </summary>

LibGit2Sharp/BranchCollectionExtensions.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,18 @@ public static Branch Add(this BranchCollection branches, string name, Commit com
3434
return branches.Add(name, commit.Sha, allowOverwrite);
3535
}
3636

37+
/// <summary>
38+
/// Create a new local branch with the specified name
39+
/// </summary>
40+
/// <param name="branches">The <see cref="BranchCollection"/> being worked with.</param>
41+
/// <param name="name">The name of the branch.</param>
42+
/// <param name="committish">Revparse spec for the target commit.</param>
43+
/// <returns>A new <see cref="Branch"/>.</returns>
44+
public static Branch Add(this BranchCollection branches, string name, string committish)
45+
{
46+
return branches.Add(name, committish, false);
47+
}
48+
3749
/// <summary>
3850
/// Deletes the branch with the specified name.
3951
/// </summary>
@@ -66,6 +78,18 @@ public static void Remove(this BranchCollection branches, string name, bool isRe
6678
branches.Remove(branch);
6779
}
6880

81+
/// <summary>
82+
/// Rename an existing local branch
83+
/// </summary>
84+
/// <param name="branch">The current local branch.</param>
85+
/// <param name="newName">The new name the existing branch should bear.</param>
86+
/// <param name="branches">The <see cref="BranchCollection"/> being worked with.</param>
87+
/// <returns>A new <see cref="Branch"/>.</returns>
88+
public static Branch Rename(this BranchCollection branches, Branch branch, string newName)
89+
{
90+
return branches.Rename(branch, newName, false);
91+
}
92+
6993
/// <summary>
7094
/// Rename an existing local branch, using the default reflog message
7195
/// </summary>

0 commit comments

Comments
 (0)