You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
With GitVersion 5.10.0, ion Azure DevOps, when GitVersion is installed on a build agent which was triggered by an automated PR Build Validation. The git branch is returned as an empty string and Gitversion setup fails.
Expected Behavior
In Gitversion 5.9.0, for PR a numbered 1751, the below can be seen in the output:
Actual Behavior
In Gitversion 5.10.0, for PR a numbered 1758, the below can be seen in the output:
Possible Fix
Steps to Reproduce
Using AzureDev Ops repo
Add a Build Validation in the Repo settings:
In the azure-pipelines.yml build file, install GitVersion and run gitversion Setup
Create a PR in DevOps and Queue the build validation:
Context
Unable to use pre-merge Build Validation in Azure Devops with GitVersion 5.10.0
Further information
Error further down the logs:
refs/remotes/pull/1758/merge (29cb882c4287dfc0c9ce867d43149a74154600cf) INFO [04/14/22 15:31:25:28] No local branch pointing at the commit '29cb882c4287dfc0c9ce867d43149a74154600cf'. Fake branch needs to be created. INFO [04/14/22 15:31:25:29] Fetching remote refs to see if there is a pull request ref INFO [04/14/22 15:31:25:33] End: Normalizing git directory for branch '' (Took: 182.17ms) ERROR [04/14/22 15:31:25:35] An unexpected error occurred: LibGit2Sharp.LibGit2SharpException: this remote has never connected at LibGit2Sharp.Core.Ensure.HandleError(Int32 result) in /_/LibGit2Sharp/Core/Ensure.cs:line 154 at LibGit2Sharp.Core.Proxy.git_remote_ls(Repository repository, RemoteHandle remote) in /_/LibGit2Sharp/Core/Proxy.cs:line 2324 at LibGit2Sharp.Network.ListReferencesInternal(String url, CredentialsHandler credentialsProvider) in /_/LibGit2Sharp/Network.cs:line 130 at LibGit2Sharp.Network.ListReferences(Remote remote) in /_/LibGit2Sharp/Network.cs:line 55 at GitVersion.GitRepository.GetPullRequestReference(AuthenticationInfo auth, Remote remote, String headTipSha) in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\GitRepository.cs:line 151 at GitVersion.GitRepository.<>c__DisplayClass28_0.<CreateBranchForPullRequestBranch>b__0() in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\GitRepository.cs:line 79 at GitVersion.RepositoryExtensions.RunSafe(Action operation) in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\RepositoryExtensions.cs:line 15 at GitVersion.GitRepository.CreateBranchForPullRequestBranch(AuthenticationInfo auth) in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\GitRepository.cs:line 69 at GitVersion.GitPreparer.<>c__DisplayClass18_0.<EnsureHeadIsAttachedToBranch>b__3() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitPreparer.cs:line 237 at GitVersion.Helpers.RetryAction`1.<>c__DisplayClass1_0.<Execute>b__0() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Helpers\RetryAction.cs:line 16 at Polly.Policy`1.<>c__DisplayClass11_0.<Execute>b__0(Context _, CancellationToken _) at Polly.Retry.RetryEngine.Implementation[TResult](Func`3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldRetryExceptionPredicates, ResultPredicates`1 shouldRetryResultPredicates, Action`4 onRetry, Int32 permittedRetryCount, IEnumerable`1 sleepDurationsEnumerable, Func`4 sleepDurationProvider) at Polly.Retry.RetryPolicy`1.Implementation(Func`3 action, Context context, CancellationToken cancellationToken) at Polly.Policy`1.Execute(Func`3 action, Context context, CancellationToken cancellationToken) at Polly.Policy`1.Execute(Func`1 action) at GitVersion.Helpers.RetryAction`2.Execute(Func`1 operation) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Helpers\RetryAction.cs:line 35 at GitVersion.Helpers.RetryAction`1.Execute(Action operation) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Helpers\RetryAction.cs:line 14 at GitVersion.GitPreparer.EnsureHeadIsAttachedToBranch(String currentBranchName, AuthenticationInfo authentication) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitPreparer.cs:line 237 at GitVersion.GitPreparer.NormalizeGitDirectory(Boolean noFetch, String currentBranchName, Boolean isDynamicRepository) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitPreparer.cs:line 183 at GitVersion.GitPreparer.NormalizeGitDirectory(String targetBranch, Boolean isDynamicRepository) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitPreparer.cs:line 134 at GitVersion.GitPreparer.PrepareInternal(GitVersionOptions gitVersionOptions) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitPreparer.cs:line 69 at GitVersion.GitPreparer.Prepare() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitPreparer.cs:line 48
The text was updated successfully, but these errors were encountered:
Describe the bug
With GitVersion 5.10.0, ion Azure DevOps, when GitVersion is installed on a build agent which was triggered by an automated PR Build Validation. The git branch is returned as an empty string and
Gitversion setup
fails.Expected Behavior
In Gitversion 5.9.0, for PR a numbered 1751, the below can be seen in the output:

Actual Behavior
In Gitversion 5.10.0, for PR a numbered 1758, the below can be seen in the output:

Possible Fix
Steps to Reproduce
azure-pipelines.yml
build file, install GitVersion and rungitversion Setup
Context
Unable to use pre-merge Build Validation in Azure Devops with GitVersion 5.10.0
Further information
Error further down the logs:
refs/remotes/pull/1758/merge (29cb882c4287dfc0c9ce867d43149a74154600cf) INFO [04/14/22 15:31:25:28] No local branch pointing at the commit '29cb882c4287dfc0c9ce867d43149a74154600cf'. Fake branch needs to be created. INFO [04/14/22 15:31:25:29] Fetching remote refs to see if there is a pull request ref INFO [04/14/22 15:31:25:33] End: Normalizing git directory for branch '' (Took: 182.17ms) ERROR [04/14/22 15:31:25:35] An unexpected error occurred: LibGit2Sharp.LibGit2SharpException: this remote has never connected at LibGit2Sharp.Core.Ensure.HandleError(Int32 result) in /_/LibGit2Sharp/Core/Ensure.cs:line 154 at LibGit2Sharp.Core.Proxy.git_remote_ls(Repository repository, RemoteHandle remote) in /_/LibGit2Sharp/Core/Proxy.cs:line 2324 at LibGit2Sharp.Network.ListReferencesInternal(String url, CredentialsHandler credentialsProvider) in /_/LibGit2Sharp/Network.cs:line 130 at LibGit2Sharp.Network.ListReferences(Remote remote) in /_/LibGit2Sharp/Network.cs:line 55 at GitVersion.GitRepository.GetPullRequestReference(AuthenticationInfo auth, Remote remote, String headTipSha) in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\GitRepository.cs:line 151 at GitVersion.GitRepository.<>c__DisplayClass28_0.<CreateBranchForPullRequestBranch>b__0() in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\GitRepository.cs:line 79 at GitVersion.RepositoryExtensions.RunSafe(Action operation) in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\RepositoryExtensions.cs:line 15 at GitVersion.GitRepository.CreateBranchForPullRequestBranch(AuthenticationInfo auth) in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\GitRepository.cs:line 69 at GitVersion.GitPreparer.<>c__DisplayClass18_0.<EnsureHeadIsAttachedToBranch>b__3() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitPreparer.cs:line 237 at GitVersion.Helpers.RetryAction`1.<>c__DisplayClass1_0.<Execute>b__0() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Helpers\RetryAction.cs:line 16 at Polly.Policy`1.<>c__DisplayClass11_0.<Execute>b__0(Context _, CancellationToken _) at Polly.Retry.RetryEngine.Implementation[TResult](Func`3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldRetryExceptionPredicates, ResultPredicates`1 shouldRetryResultPredicates, Action`4 onRetry, Int32 permittedRetryCount, IEnumerable`1 sleepDurationsEnumerable, Func`4 sleepDurationProvider) at Polly.Retry.RetryPolicy`1.Implementation(Func`3 action, Context context, CancellationToken cancellationToken) at Polly.Policy`1.Execute(Func`3 action, Context context, CancellationToken cancellationToken) at Polly.Policy`1.Execute(Func`1 action) at GitVersion.Helpers.RetryAction`2.Execute(Func`1 operation) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Helpers\RetryAction.cs:line 35 at GitVersion.Helpers.RetryAction`1.Execute(Action operation) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Helpers\RetryAction.cs:line 14 at GitVersion.GitPreparer.EnsureHeadIsAttachedToBranch(String currentBranchName, AuthenticationInfo authentication) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitPreparer.cs:line 237 at GitVersion.GitPreparer.NormalizeGitDirectory(Boolean noFetch, String currentBranchName, Boolean isDynamicRepository) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitPreparer.cs:line 183 at GitVersion.GitPreparer.NormalizeGitDirectory(String targetBranch, Boolean isDynamicRepository) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitPreparer.cs:line 134 at GitVersion.GitPreparer.PrepareInternal(GitVersionOptions gitVersionOptions) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitPreparer.cs:line 69 at GitVersion.GitPreparer.Prepare() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitPreparer.cs:line 48
The text was updated successfully, but these errors were encountered: