@@ -13,7 +13,7 @@ namespace LibGit2Sharp
13
13
/// </summary>
14
14
public class BranchCollection : IEnumerable < Branch >
15
15
{
16
- private readonly Repository repo ;
16
+ internal readonly Repository repo ;
17
17
18
18
/// <summary>
19
19
/// Needed for mocking purposes.
@@ -133,23 +133,6 @@ IEnumerator IEnumerable.GetEnumerator()
133
133
134
134
#endregion
135
135
136
- /// <summary>
137
- /// Create a new local branch with the specified name
138
- /// </summary>
139
- /// <param name = "name">The name of the branch.</param>
140
- /// <param name = "commitish">Revparse spec for the target commit.</param>
141
- /// <param name = "allowOverwrite">True to allow silent overwriting a potentially existing branch, false otherwise.</param>
142
- /// <returns>A new <see cref="Branch"/>.</returns>
143
- public virtual Branch Add ( string name , string commitish , bool allowOverwrite = false )
144
- {
145
- Ensure . ArgumentNotNullOrEmptyString ( name , "name" ) ;
146
- Ensure . ArgumentNotNullOrEmptyString ( commitish , "commitish" ) ;
147
-
148
- Commit commit = repo . LookupCommit ( commitish ) ;
149
-
150
- return Add ( name , commit , allowOverwrite ) ;
151
- }
152
-
153
136
/// <summary>
154
137
/// Create a new local branch with the specified name
155
138
/// </summary>
@@ -177,19 +160,7 @@ public virtual Branch Add(string name, Commit commit, bool allowOverwrite = fals
177
160
[ Obsolete ( "This method will be removed in the next release. Please use Add() instead." ) ]
178
161
public virtual Branch Create ( string name , string commitish , bool allowOverwrite = false )
179
162
{
180
- return Add ( name , commitish , allowOverwrite ) ;
181
- }
182
-
183
- /// <summary>
184
- /// Deletes the branch with the specified name.
185
- /// </summary>
186
- /// <param name = "name">The name of the branch to delete.</param>
187
- /// <param name = "isRemote">True if the provided <paramref name="name"/> is the name of a remote branch, false otherwise.</param>
188
- public virtual void Remove ( string name , bool isRemote = false )
189
- {
190
- Ensure . ArgumentNotNullOrEmptyString ( name , "name" ) ;
191
-
192
- Proxy . git_branch_delete ( repo . Handle , name , isRemote ? GitBranchType . GIT_BRANCH_REMOTE : GitBranchType . GIT_BRANCH_LOCAL ) ;
163
+ return this . Add ( name , commitish , allowOverwrite ) ;
193
164
}
194
165
195
166
/// <summary>
@@ -200,7 +171,7 @@ public virtual void Remove(Branch branch)
200
171
{
201
172
Ensure . ArgumentNotNull ( branch , "branch" ) ;
202
173
203
- Remove ( branch . Name , branch . IsRemote ) ;
174
+ this . Remove ( branch . Name , branch . IsRemote ) ;
204
175
}
205
176
206
177
/// <summary>
@@ -211,24 +182,7 @@ public virtual void Remove(Branch branch)
211
182
[ Obsolete ( "This method will be removed in the next release. Please use Remove() instead." ) ]
212
183
public virtual void Delete ( string name , bool isRemote = false )
213
184
{
214
- Remove ( name , isRemote ) ;
215
- }
216
-
217
- /// <summary>
218
- /// Renames an existing local branch with a new name.
219
- /// </summary>
220
- /// <param name = "currentName">The current branch name.</param>
221
- /// <param name = "newName">The new name the existing branch should bear.</param>
222
- /// <param name = "allowOverwrite">True to allow silent overwriting a potentially existing branch, false otherwise.</param>
223
- /// <returns>A new <see cref="Branch"/>.</returns>
224
- public virtual Branch Move ( string currentName , string newName , bool allowOverwrite = false )
225
- {
226
- Ensure . ArgumentNotNullOrEmptyString ( currentName , "currentName" ) ;
227
- Ensure . ArgumentNotNullOrEmptyString ( newName , "newName" ) ;
228
-
229
- Proxy . git_branch_move ( repo . Handle , currentName , newName , allowOverwrite ) ;
230
-
231
- return this [ newName ] ;
185
+ this . Remove ( name , isRemote ) ;
232
186
}
233
187
234
188
/// <summary>
@@ -248,7 +202,7 @@ public virtual Branch Move(Branch branch, string newName, bool allowOverwrite =
248
202
throw new LibGit2SharpException ( string . Format ( "Cannot rename branch '{0}'. It's a remote tracking branch." , branch . Name ) ) ;
249
203
}
250
204
251
- return Move ( branch . Name , newName , allowOverwrite ) ;
205
+ return this . Move ( branch . Name , newName , allowOverwrite ) ;
252
206
}
253
207
254
208
private static bool LooksLikeABranchName ( string referenceName )
0 commit comments