Skip to content

Commit 5ae5681

Browse files
committed
re #611 - Ensures branch when using dynamic repositories with buildserver
When using a dynamic repository with a buildserver the current branch will for most buildserver types return null or empty, this causes no branch to be set, dynamic repositories require a branch. The fix ensures that if we are using dynamic repositories with a buildserver that if the buildserver does not return a branch we use the targetBranch specified via /b
1 parent c894b3d commit 5ae5681

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/GitVersionCore/ExecuteCore.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ public static VersionVariables ExecuteGitVersion(IFileSystem fileSystem, string
1313
var applicableBuildServers = BuildServerList.GetApplicableBuildServers();
1414
var buildServer = applicableBuildServers.FirstOrDefault();
1515
var currentBranch = buildServer == null ? null : buildServer.GetCurrentBranch();
16+
17+
currentBranch = string.IsNullOrWhiteSpace(currentBranch) ? targetBranch : currentBranch;
1618
if (!string.IsNullOrEmpty(currentBranch))
1719
{
1820
Logger.WriteInfo("Branch from build environment: " + currentBranch);

0 commit comments

Comments
 (0)