Skip to content

Commit f00c23c

Browse files
committed
Moved nofetch option so it doesn't skip normalisation entirely when specified
1 parent 28dfe31 commit f00c23c

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/GitVersionCore/BuildServers/GitHelper.cs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@ public static class GitHelper
1212

1313
public static void NormalizeGitDirectory(string gitDirectory, Authentication authentication, bool noFetch)
1414
{
15-
//If noFetch is enabled, then GitVersion will assume that the git repository is normalized before execution, so that fetching from remotes is not required.
16-
if (noFetch)
17-
{
18-
Logger.WriteInfo("Skipping fetching");
19-
return;
20-
}
21-
2215
using (var repo = new Repository(gitDirectory))
2316
{
2417
var remote = EnsureOnlyOneRemoteIsDefined(repo);
@@ -28,8 +21,14 @@ public static void NormalizeGitDirectory(string gitDirectory, Authentication aut
2821
Logger.WriteInfo(string.Format("Fetching from remote '{0}' using the following refspecs: {1}.",
2922
remote.Name, string.Join(", ", remote.FetchRefSpecs.Select(r => r.Specification))));
3023

31-
var fetchOptions = BuildFetchOptions(authentication.Username, authentication.Password);
32-
repo.Network.Fetch(remote, fetchOptions);
24+
25+
//If noFetch is enabled, then GitVersion will assume that the git repository is normalized before execution, so that fetching from remotes is not required.
26+
if (!noFetch)
27+
{
28+
Logger.WriteInfo("Skipping fetching");
29+
var fetchOptions = BuildFetchOptions(authentication.Username, authentication.Password);
30+
repo.Network.Fetch(remote, fetchOptions);
31+
}
3332

3433
CreateMissingLocalBranchesFromRemoteTrackingOnes(repo, remote.Name);
3534

0 commit comments

Comments
 (0)