Skip to content

Commit a103d64

Browse files
author
Jake Ginnivan
committed
Removed code which creates a NextVersion.txt file if there are no tags
1 parent c25e688 commit a103d64

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

GitVersionCore/GitHubFlow/GitHubFlowVersionFinder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public class GitHubFlowVersionFinder
55
public SemanticVersion FindVersion(GitVersionContext context)
66
{
77
var repositoryDirectory = context.Repository.Info.WorkingDirectory;
8-
var lastTaggedReleaseFinder = new LastTaggedReleaseFinder(context.Repository, repositoryDirectory);
8+
var lastTaggedReleaseFinder = new LastTaggedReleaseFinder(context.Repository);
99
return new BuildNumberCalculator(new NextSemverCalculator(new NextVersionTxtFileFinder(repositoryDirectory),
1010
lastTaggedReleaseFinder), lastTaggedReleaseFinder, context.Repository).GetBuildNumber(context);
1111
}

GitVersionCore/GitHubFlow/LastTaggedReleaseFinder.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
namespace GitVersion
22
{
33
using System;
4-
using System.IO;
54
using System.Linq;
65
using LibGit2Sharp;
76

87
public class LastTaggedReleaseFinder
98
{
10-
string workingDirectory;
119
Lazy<VersionTaggedCommit> lastTaggedRelease;
1210

13-
public LastTaggedReleaseFinder(IRepository gitRepo, string workingDirectory)
11+
public LastTaggedReleaseFinder(IRepository gitRepo)
1412
{
15-
this.workingDirectory = workingDirectory;
1613
lastTaggedRelease = new Lazy<VersionTaggedCommit>(() => GetVersion(gitRepo));
1714
}
1815

@@ -42,11 +39,6 @@ VersionTaggedCommit GetVersion(IRepository gitRepo)
4239
if (lastTaggedCommit != null)
4340
return tags.Last(a => a.Commit.Sha == lastTaggedCommit.Sha);
4441

45-
// Create a next version txt as 0.1.0
46-
var filePath = Path.Combine(workingDirectory, "NextVersion.txt");
47-
if (!File.Exists(filePath))
48-
File.WriteAllText(filePath, "0.1.0");
49-
5042
var commit = branch.Commits.Last();
5143
return new VersionTaggedCommit(commit, new SemanticVersion());
5244
}

0 commit comments

Comments
 (0)