From 5f523b8ef2ad5365ba5302ee65e3c57bd07de2f7 Mon Sep 17 00:00:00 2001 From: Simona Avornicesei Date: Mon, 20 Jan 2020 12:26:49 +0200 Subject: [PATCH] #273 Support GitVersion - change git fetch command --- project/core/sourcecontrol/Git.cs | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/project/core/sourcecontrol/Git.cs b/project/core/sourcecontrol/Git.cs index c07f0ead0..083101d07 100644 --- a/project/core/sourcecontrol/Git.cs +++ b/project/core/sourcecontrol/Git.cs @@ -454,6 +454,8 @@ private RepositoryAction CreateUpateLocalRepository(IIntegrationResult result) /// /// Setup the local repository with some required config settings. /// + /// Always: + /// - /// For tagging: /// - User name /// - User e-mail @@ -461,6 +463,9 @@ private RepositoryAction CreateUpateLocalRepository(IIntegrationResult result) /// IIntegrationResult of the current build. private void SetupLocalRepository(IIntegrationResult result) { + + GitConfigSet("remote.origin.url", Repository, result); + if (!string.IsNullOrEmpty(CommitterName) && !string.IsNullOrEmpty(CommitterEMail)) { GitConfigSet("user.name", CommitterName, result); @@ -617,10 +622,14 @@ private void GitFetch(IIntegrationResult result) { ProcessArgumentBuilder buffer = new ProcessArgumentBuilder(); buffer.AddArgument("fetch"); - buffer.AddArgument("origin"); - - // initialize progress information - var bpi = GetBuildProgressInformation(result); + buffer.AddArgument("--tags"); + buffer.AddArgument("--force"); + buffer.AddArgument("--progress"); + buffer.AddArgument("origin"); + buffer.AddArgument("+refs/heads/*:refs/remotes/origin/*"); + + // initialize progress information + var bpi = GetBuildProgressInformation(result); bpi.SignalStartRunTask(string.Concat("git ", buffer.ToString())); // enable Stdout monitoring @@ -632,12 +641,12 @@ private void GitFetch(IIntegrationResult result) ProcessExecutor.ProcessOutput -= ProcessExecutor_ProcessOutput; } - /// - /// Checkout a remote branch with the "git checkout -q -f 'origin/branchName'" command. - /// - /// Name of the branch to checkout. - /// IIntegrationResult of the current build. - private void GitCheckoutRemoteBranch(string branchName, IIntegrationResult result) + /// + /// Checkout a remote branch with the "git checkout -q -f 'origin/branchName'" command. + /// + /// Name of the branch to checkout. + /// IIntegrationResult of the current build. + private void GitCheckoutRemoteBranch(string branchName, IIntegrationResult result) { ProcessArgumentBuilder buffer = new ProcessArgumentBuilder(); buffer.AddArgument("checkout");