{"action":"created","issue":{"url":"https://api.github.com/repos/GitTools/GitVersion/issues/611","labels_url":"https://api.github.com/repos/GitTools/GitVersion/issues/611/labels{/name}","comments_url":"https://api.github.com/repos/GitTools/GitVersion/issues/611/comments","events_url":"https://api.github.com/repos/GitTools/GitVersion/issues/611/events","html_url":"https://github.com/GitTools/GitVersion/issues/611","id":103120081,"number":611,"title":"GitVersion fails to pull a dymanic repository when on TeamCity","user":{"login":"RichiCoder1","id":2391878,"avatar_url":"https://avatars.githubusercontent.com/u/2391878?v=3","gravatar_id":"","url":"https://api.github.com/users/RichiCoder1","html_url":"https://github.com/RichiCoder1","followers_url":"https://api.github.com/users/RichiCoder1/followers","following_url":"https://api.github.com/users/RichiCoder1/following{/other_user}","gists_url":"https://api.github.com/users/RichiCoder1/gists{/gist_id}","starred_url":"https://api.github.com/users/RichiCoder1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/RichiCoder1/subscriptions","organizations_url":"https://api.github.com/users/RichiCoder1/orgs","repos_url":"https://api.github.com/users/RichiCoder1/repos","events_url":"https://api.github.com/users/RichiCoder1/events{/privacy}","received_events_url":"https://api.github.com/users/RichiCoder1/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-25T21:21:13Z","updated_at":"2015-08-26T13:52:57Z","closed_at":null,"body":"Here's the error message:\r\n```\r\nC:\\Source\\core [release/2.2.0 +1 ~4 -0 !]> .\\tools\\GitVersion.CommandLine\\tools\\GitVersion.exe /url \"******\" /u ******* /p ********* /b \"refs/heads/release/2.2.0\" /c ea0f3605343b5703b98815e8f34c04dda91f9564 /output json\r\nINFO [08/25/15 16:14:47:55] Working directory: C:\\Source\\core\r\nINFO [08/25/15 16:14:47:56] Applicable build agent found: 'TeamCity'.\r\nERROR [08/25/15 16:14:47:56] An unexpected error occurred:\r\nSystem.Exception: Dynamic Git repositories must have a target branch (/b)\r\n   at GitVersion.GitPreparer.CreateDynamicRepository(String targetPath, Authentication authentication, String repositoryUrl, String targetBranch, Boolean noFetch)\r\n   at GitVersion.GitPreparer.Initialise(Boolean normaliseGitDirectory, String currentBranch)\r\n   at GitVersion.ExecuteCore.ExecuteGitVersion(IFileSystem fileSystem, String targetUrl, String dynamicRepositoryLocation, Authentication authentication, String targetBranch, Boolean noFetch, String workingDirectory, String commitId)\r\n   at GitVersion.SpecifiedArgumentRunner.Run(Arguments arguments, IFileSystem fileSystem)\r\n   at GitVersion.Program.VerifyArgumentsAndRun()\r\n```\r\n\r\nSource at fault: https://github.com/GitTools/GitVersion/blob/master/src/GitVersionCore/ExecuteCore.cs#L20\r\n\r\nTeamCity returns `string.Empty` which cases `currentBranch ?? targetBranch` to evaluate to `string.Empty`. Can be fixed by instead writing:\r\n```csharp\r\ngitPreparer.Initialise(buildServer != null, string.IsNullOrWhiteSpace(currentBranch) ? targetBranch : currentBranch); \r\n```\r\nThis is a somewhat critical bug as it does block using 3.1.0 at all, though we're experimenting with a work around where we kill `$env.TEAMCITY_VERSION` for the lifetime of the git version run.\r\n\r\nEDIT: Workaround worked :). World not as ending."},"comment":{"url":"https://api.github.com/repos/GitTools/GitVersion/issues/comments/135027743","html_url":"https://github.com/GitTools/GitVersion/issues/611#issuecomment-135027743","issue_url":"https://api.github.com/repos/GitTools/GitVersion/issues/611","id":135027743,"user":{"login":"furrot","id":7373782,"avatar_url":"https://avatars.githubusercontent.com/u/7373782?v=3","gravatar_id":"","url":"https://api.github.com/users/furrot","html_url":"https://github.com/furrot","followers_url":"https://api.github.com/users/furrot/followers","following_url":"https://api.github.com/users/furrot/following{/other_user}","gists_url":"https://api.github.com/users/furrot/gists{/gist_id}","starred_url":"https://api.github.com/users/furrot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/furrot/subscriptions","organizations_url":"https://api.github.com/users/furrot/orgs","repos_url":"https://api.github.com/users/furrot/repos","events_url":"https://api.github.com/users/furrot/events{/privacy}","received_events_url":"https://api.github.com/users/furrot/received_events","type":"User","site_admin":false},"created_at":"2015-08-26T13:52:57Z","updated_at":"2015-08-26T13:52:57Z","body":"Any chance you'll publish the build soon for this? Can't figure out a workaround."}}