Skip to content

Commit 7c27ad0

Browse files
committed
Removed config file related code (will be read from working directory, not git dir), and no longer delete dynamic repo once done.
1 parent ce79e55 commit 7c27ad0

File tree

3 files changed

+5
-35
lines changed

3 files changed

+5
-35
lines changed

GitVersionExe.Tests/GitPreparerTests.cs

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@ public GitPreparerTests()
2020
const string SpecificBranchName = "feature/foo";
2121

2222
[Test]
23-
[TestCase(null, DefaultBranchName, false)]
24-
[TestCase(SpecificBranchName, SpecificBranchName, false)]
25-
[TestCase(null, DefaultBranchName, true)]
26-
[TestCase(SpecificBranchName, SpecificBranchName, true)]
27-
public void WorksCorrectlyWithRemoteRepository(string branchName, string expectedBranchName, bool checkConfig)
23+
[TestCase(null, DefaultBranchName)]
24+
[TestCase(SpecificBranchName, SpecificBranchName)]
25+
public void WorksCorrectlyWithRemoteRepository(string branchName, string expectedBranchName)
2826
{
2927
var repoName = Guid.NewGuid().ToString();
3028
var tempPath = Path.GetTempPath();
@@ -41,22 +39,8 @@ public void WorksCorrectlyWithRemoteRepository(string branchName, string expecte
4139
fixture.Repository.MakeCommits(5);
4240
fixture.Repository.CreateFileAndCommit("TestFile.txt");
4341

44-
if (checkConfig)
45-
{
46-
fixture.Repository.CreateFileAndCommit("GitVersionConfig.yaml");
47-
}
48-
4942
fixture.Repository.CreateBranch(SpecificBranchName);
5043

51-
if (checkConfig)
52-
{
53-
fixture.Repository.Refs.UpdateTarget(fixture.Repository.Refs.Head, fixture.Repository.Refs["refs/heads/" + SpecificBranchName]);
54-
55-
fixture.Repository.CreateFileAndCommit("GitVersionConfig.yaml");
56-
57-
fixture.Repository.Refs.UpdateTarget(fixture.Repository.Refs.Head, fixture.Repository.Refs["refs/heads/" + DefaultBranchName]);
58-
}
59-
6044
var arguments = new Arguments
6145
{
6246
TargetPath = tempDir,
@@ -83,12 +67,6 @@ public void WorksCorrectlyWithRemoteRepository(string branchName, string expecte
8367
var currentBranch = repository.Head.CanonicalName;
8468

8569
currentBranch.EndsWith(expectedBranchName).ShouldBe(true);
86-
87-
if (checkConfig)
88-
{
89-
var expectedConfigPath = Path.Combine(dynamicRepositoryPath, "..\\GitVersionConfig.yaml");
90-
File.Exists(expectedConfigPath).ShouldBe(true);
91-
}
9270
}
9371
}
9472
}

GitVersionExe/GitPreparer.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,9 @@ static string CreateDynamicRepository(string targetPath, Authentication authenti
8585
var gitDirectory = Path.Combine(targetPath, ".git");
8686
if (Directory.Exists(targetPath))
8787
{
88-
Logger.WriteInfo(string.Format("Deleting existing .git folder from '{0}' to force new checkout from url", targetPath));
88+
Logger.WriteInfo("Git repository already exists at {0}, skipping clone");
8989

90-
DeleteHelper.DeleteGitRepository(targetPath);
90+
return gitDirectory;
9191
}
9292

9393
Credentials credentials = null;
@@ -150,9 +150,6 @@ static string CreateDynamicRepository(string targetPath, Authentication authenti
150150

151151
repository.Refs.UpdateTarget(repository.Refs.Head, newHead);
152152
}
153-
154-
// > 3.0 method
155-
repository.CheckoutFilesIfExist("GitVersionConfig.yaml");
156153
}
157154

158155
return gitDirectory;

GitVersionExe/SpecifiedArgumentRunner.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,6 @@ public static void Run(Arguments arguments, IFileSystem fileSystem)
7979
//}
8080
}
8181
}
82-
83-
if (gitPreparer.IsDynamicGitRepository)
84-
{
85-
DeleteHelper.DeleteGitRepository(gitPreparer.DynamicGitRepositoryPath);
86-
}
8782
}
8883

8984
static IEnumerable<IBuildServer> GetApplicableBuildServers(Authentication authentication)

0 commit comments

Comments
 (0)