Skip to content

Commit 1ed8a4f

Browse files
committed
Rename Delete to Remove in TagCollection
1 parent 46a6279 commit 1ed8a4f

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

LibGit2Sharp.Tests/TagFixture.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -449,40 +449,40 @@ public void AddTagWithNullTargetThrows()
449449
}
450450

451451
[Fact]
452-
public void CanDeleteATagThroughItsName()
452+
public void CanRemoveATagThroughItsName()
453453
{
454454
TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo();
455455
using (var repo = new Repository(path.RepositoryPath))
456456
{
457-
repo.Tags.Delete("e90810b");
457+
repo.Tags.Remove("e90810b");
458458
}
459459
}
460460

461461
[Fact]
462-
public void CanDeleteATagThroughItsCanonicalName()
462+
public void CanRemoveATagThroughItsCanonicalName()
463463
{
464464
TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo();
465465
using (var repo = new Repository(path.RepositoryPath))
466466
{
467-
repo.Tags.Delete("refs/tags/e90810b");
467+
repo.Tags.Remove("refs/tags/e90810b");
468468
}
469469
}
470470

471471
[Fact]
472-
public void ADeletedTagCannotBeLookedUp()
472+
public void ARemovedTagCannotBeLookedUp()
473473
{
474474
TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo();
475475
using (var repo = new Repository(path.RepositoryPath))
476476
{
477477
const string tagName = "e90810b";
478478

479-
repo.Tags.Delete(tagName);
479+
repo.Tags.Remove(tagName);
480480
Assert.Null(repo.Tags[tagName]);
481481
}
482482
}
483483

484484
[Fact]
485-
public void DeletingATagDecreasesTheTagsCount()
485+
public void RemovingATagDecreasesTheTagsCount()
486486
{
487487
TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo();
488488
using (var repo = new Repository(path.RepositoryPath))
@@ -492,7 +492,7 @@ public void DeletingATagDecreasesTheTagsCount()
492492
List<string> tags = repo.Tags.Select(r => r.Name).ToList();
493493
Assert.True(tags.Contains(tagName));
494494

495-
repo.Tags.Delete(tagName);
495+
repo.Tags.Remove(tagName);
496496

497497
List<string> tags2 = repo.Tags.Select(r => r.Name).ToList();
498498
Assert.False(tags2.Contains(tagName));
@@ -503,11 +503,11 @@ public void DeletingATagDecreasesTheTagsCount()
503503

504504
[Fact]
505505
// Ported from cgit (https://github.com/git/git/blob/1c08bf50cfcf924094eca56c2486a90e2bf1e6e2/t/t7004-tag.sh#L108)
506-
public void DeletingAnUnknownTagShouldFail()
506+
public void RemovingAnUnknownTagShouldFail()
507507
{
508508
using (var repo = new Repository(BareTestRepoPath))
509509
{
510-
Assert.Throws<LibGit2SharpException>(() => repo.Tags.Delete("unknown-tag"));
510+
Assert.Throws<LibGit2SharpException>(() => repo.Tags.Remove("unknown-tag"));
511511
}
512512
}
513513

LibGit2Sharp/TagCollection.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,24 @@ public Tag Create(string name, string target, bool allowOverwrite = false)
152152
/// Deletes the tag with the specified name.
153153
/// </summary>
154154
/// <param name = "name">The short or canonical name of the tag to delete.</param>
155-
public void Delete(string name)
155+
public void Remove(string name)
156156
{
157157
Ensure.ArgumentNotNullOrEmptyString(name, "name");
158158

159159
int res = NativeMethods.git_tag_delete(repo.Handle, UnCanonicalizeName(name));
160160
Ensure.Success(res);
161161
}
162162

163+
/// <summary>
164+
/// Deletes the tag with the specified name.
165+
/// </summary>
166+
/// <param name = "name">The short or canonical name of the tag to delete.</param>
167+
[Obsolete("This method will be removed in the next release. Please use Remove() instead.")]
168+
public void Delete(string name)
169+
{
170+
Remove(name);
171+
}
172+
163173
private static string NormalizeToCanonicalName(string name)
164174
{
165175
Ensure.ArgumentNotNullOrEmptyString(name, "name");

0 commit comments

Comments
 (0)