Skip to content

Commit 983238b

Browse files
MarkusHorstmannarturcic
authored andcommitted
Use default retry count (5) for locked files
1 parent b66ac01 commit 983238b

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/GitVersion.Core/Core/GitPreparer.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ private void CreateOrUpdateLocalBranchesFromRemoteTrackingOnes(string remoteName
330330
}
331331
var remoteRefTipId = remoteTrackingReference.ReferenceTargetId;
332332
log.Info($"Updating local ref '{localRef.Name.Canonical}' to point at {remoteRefTipId}.");
333-
new OperationWithExponentialBackoff<LockedFileException>(new ThreadSleep(), log, () => repository.Refs.UpdateTarget(localRef, remoteRefTipId), maxRetries: 6).ExecuteAsync().Wait();
333+
new OperationWithExponentialBackoff<LockedFileException>(new ThreadSleep(), log, () => repository.Refs.UpdateTarget(localRef, remoteRefTipId)).ExecuteAsync().Wait();
334334
continue;
335335
}
336336

@@ -383,7 +383,7 @@ public void EnsureLocalBranchExistsForCurrentBranch(IRemote remote, string curre
383383
log.Info(isBranch ? $"Updating local branch {referenceName} to point at {repoTip}"
384384
: $"Updating local branch {referenceName} to match ref {currentBranch}");
385385
var localRef = repository.Refs[localCanonicalName];
386-
new OperationWithExponentialBackoff<LockedFileException>(new ThreadSleep(), log, () => repository.Refs.UpdateTarget(localRef, repoTipId), maxRetries: 6).ExecuteAsync().Wait();
386+
new OperationWithExponentialBackoff<LockedFileException>(new ThreadSleep(), log, () => repository.Refs.UpdateTarget(localRef, repoTipId)).ExecuteAsync().Wait();
387387
}
388388

389389
repository.Checkout(localCanonicalName);

src/GitVersion.Core/Model/VersionVariables.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public static VersionVariables FromJson(string json)
166166

167167
public static VersionVariables FromFile(string filePath, IFileSystem fileSystem, ILog log)
168168
{
169-
var retryOperation = new OperationWithExponentialBackoff<IOException, VersionVariables>(new ThreadSleep(), null, () => FromFileInternal(filePath, fileSystem), maxRetries: 6);
169+
var retryOperation = new OperationWithExponentialBackoff<IOException, VersionVariables>(new ThreadSleep(), null, () => FromFileInternal(filePath, fileSystem));
170170

171171
var versionVariables = retryOperation.ExecuteAsync().Result;
172172
return versionVariables;

src/GitVersion.Core/VersionConverters/OutputGenerator/OutputGenerator.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public void Execute(VersionVariables variables, OutputContext context)
3838
}
3939
if (gitVersionOptions.Output.Contains(OutputType.File))
4040
{
41-
var retryOperation = new OperationWithExponentialBackoff<IOException>(new ThreadSleep(), log, () => fileSystem.WriteAllText(context.OutputFile, variables.ToString()), maxRetries: 6);
41+
var retryOperation = new OperationWithExponentialBackoff<IOException>(new ThreadSleep(), log, () => fileSystem.WriteAllText(context.OutputFile, variables.ToString()));
4242
retryOperation.ExecuteAsync().Wait();
4343
}
4444
if (gitVersionOptions.Output.Contains(OutputType.Json))

src/GitVersion.LibGit2Sharp/Git/GitRepository.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public ICommit FindMergeBase(ICommit commit, ICommit otherCommit)
5858
{
5959
var mergeBase = repositoryInstance.ObjectDatabase.FindMergeBase((Commit)commit, (Commit)otherCommit);
6060
return new Commit(mergeBase);
61-
}, 6).ExecuteAsync().Result;
61+
}).ExecuteAsync().Result;
6262
}
6363

6464
public int GetNumberOfUncommittedChanges()
@@ -91,7 +91,7 @@ public int GetNumberOfUncommittedChanges()
9191
DiffTargets.Index | DiffTargets.WorkingDirectory);
9292

9393
return changes.Count;
94-
}, 6).ExecuteAsync().Result;
94+
}).ExecuteAsync().Result;
9595
}
9696
public void CreateBranchForPullRequestBranch(AuthenticationInfo auth)
9797
{
@@ -151,7 +151,7 @@ public void CreateBranchForPullRequestBranch(AuthenticationInfo auth)
151151
var message = $"Remote tip '{canonicalName}' from remote '{remote.Url}' doesn't look like a valid pull request.";
152152
throw new WarningException(message);
153153
}
154-
}, 6).ExecuteAsync().Wait();
154+
}).ExecuteAsync().Wait();
155155
}
156156
public void Clone(string sourceUrl, string workdirPath, AuthenticationInfo auth)
157157
{
@@ -161,7 +161,7 @@ public void Clone(string sourceUrl, string workdirPath, AuthenticationInfo auth)
161161
{
162162
var path = Repository.Clone(sourceUrl, workdirPath, GetCloneOptions(auth));
163163
log.Info($"Returned path after repository clone: {path}");
164-
}, 6).ExecuteAsync().Wait();
164+
}).ExecuteAsync().Wait();
165165
}
166166
catch (LibGit2SharpException ex)
167167
{
@@ -184,12 +184,12 @@ public void Clone(string sourceUrl, string workdirPath, AuthenticationInfo auth)
184184
}
185185
public void Checkout(string commitOrBranchSpec)
186186
{
187-
new OperationWithExponentialBackoff<LockedFileException>(new ThreadSleep(), log, () => Commands.Checkout(repositoryInstance, commitOrBranchSpec), 6).ExecuteAsync().Wait();
187+
new OperationWithExponentialBackoff<LockedFileException>(new ThreadSleep(), log, () => Commands.Checkout(repositoryInstance, commitOrBranchSpec)).ExecuteAsync().Wait();
188188
}
189189

190190
public void Fetch(string remote, IEnumerable<string> refSpecs, AuthenticationInfo auth, string logMessage)
191191
{
192-
new OperationWithExponentialBackoff<LockedFileException>(new ThreadSleep(), log, () => Commands.Fetch((Repository)repositoryInstance, remote, refSpecs, GetFetchOptions(auth), logMessage), 6).ExecuteAsync().Wait();
192+
new OperationWithExponentialBackoff<LockedFileException>(new ThreadSleep(), log, () => Commands.Fetch((Repository)repositoryInstance, remote, refSpecs, GetFetchOptions(auth), logMessage)).ExecuteAsync().Wait();
193193
}
194194
internal static string Discover(string path) => Repository.Discover(path);
195195

0 commit comments

Comments
 (0)