Skip to content

Commit affb7fb

Browse files
committed
remove redundant method
1 parent c13c113 commit affb7fb

File tree

2 files changed

+0
-97
lines changed

2 files changed

+0
-97
lines changed

GitVersionCore/LibGitExtensions.cs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,6 @@ public static Branch FindBranch(this IRepository repository, string branchName)
2424
return repository.Branches.FirstOrDefault(x => x.Name == "origin/" + branchName);
2525
}
2626

27-
public static SemanticVersion NewestSemVerTag(this IRepository repository, Commit commit)
28-
{
29-
foreach (var tag in repository.TagsByDate(commit))
30-
{
31-
SemanticVersion version;
32-
if (SemanticVersion.TryParse(tag.Name, out version))
33-
{
34-
return version;
35-
}
36-
}
37-
38-
return null;
39-
}
40-
4127
public static IEnumerable<Tag> TagsByDate(this IRepository repository, Commit commit)
4228
{
4329
return repository.Tags

GitVersionTask.Tests/LibGitExtensionsTests.cs

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System.Collections.Generic;
21
using System.Linq;
32
using FluentDate;
43
using FluentDateTimeOffset;
@@ -9,88 +8,6 @@
98
[TestFixture]
109
public class LibGitExtensionsTests
1110
{
12-
[Test]
13-
public void NewestSemVerTag_RetrieveTheHighestSemanticVersionPointingAtTheSpecifiedCommit()
14-
{
15-
var mockCommit = new MockCommit();
16-
var repo = new MockRepository
17-
{
18-
Tags = new MockTagCollection
19-
{
20-
Tags = new List<Tag>
21-
{
22-
new MockTag
23-
{
24-
NameEx = "a",
25-
TargetEx = mockCommit,
26-
AnnotationEx = new MockTagAnnotation
27-
{
28-
TaggerEx = new Signature("a", "", 7.Seconds().Ago())
29-
}
30-
},
31-
new MockTag
32-
{
33-
NameEx = "9.0.0a",
34-
TargetEx = mockCommit,
35-
AnnotationEx = new MockTagAnnotation
36-
{
37-
TaggerEx = new Signature("a", "", 5.Seconds().Ago())
38-
}
39-
},
40-
new MockTag
41-
{
42-
NameEx = "0.1.0",
43-
TargetEx = mockCommit,
44-
AnnotationEx = new MockTagAnnotation
45-
{
46-
TaggerEx = new Signature("a", "", 1.Seconds().Ago())
47-
}
48-
},
49-
new MockTag
50-
{
51-
NameEx = "0.2.0",
52-
TargetEx = mockCommit,
53-
AnnotationEx = new MockTagAnnotation
54-
{
55-
TaggerEx = new Signature("a", "", 5.Seconds().Ago())
56-
}
57-
},
58-
}
59-
}
60-
};
61-
62-
var version = repo.NewestSemVerTag(mockCommit);
63-
64-
Assert.AreEqual(0, version.Major);
65-
Assert.AreEqual(1, version.Minor);
66-
Assert.AreEqual(0, version.Patch);
67-
}
68-
69-
[Test]
70-
public void NewestSemVerTag_ReturnNullWhenNoTagPointingAtTheSpecifiedCommitHasBeenFound()
71-
{
72-
var tagNames = new[] { "a", "9.0.0", "z", "0.1.0", "11.1.0", "0.2.0" };
73-
74-
var col = new MockTagCollection();
75-
foreach (var tagName in tagNames)
76-
{
77-
col.Add(new MockTag
78-
{
79-
NameEx = tagName,
80-
TargetEx = null,
81-
AnnotationEx = new MockTagAnnotation
82-
{
83-
TaggerEx = new Signature("a", "", 5.Seconds().Ago())
84-
}
85-
});
86-
}
87-
88-
var repo = new MockRepository { Tags = col };
89-
90-
var version = repo.NewestSemVerTag(new MockCommit());
91-
92-
Assert.IsNull(version);
93-
}
9411

9512
[Test]
9613
public void TagsByDate_HonorChainedAnnotatedTags()

0 commit comments

Comments
 (0)