Skip to content

Commit

Permalink
Merge pull request #109 from AshleighAdams/harden-repo-deepening
Browse files Browse the repository at this point in the history
GitRepoInspector: Hardend auto-fetching some more
  • Loading branch information
AshleighAdams authored Oct 21, 2022
2 parents 27a036e + cb085f2 commit cc23a4e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/Verlite.Core/GitRepoInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,18 @@ private async Task<string> GetCommitObject(Commit commit)
else if (!CanDeepen)
throw new RepoTooShallowException();

await Deepen();
commitObj = await GetCommitObjectInternal(commit);
int hardMaxRetries = 1000;
while (commitObj is null)
{
if (hardMaxRetries-- <= 0)
throw new AutoDeepenException("Failed to deepen the repository. Maximum attempts reached.");
await Deepen();
commitObj = await GetCommitObjectInternal(commit);
}

return commitObj
?? throw new AutoDeepenException($"Deepened repo did not contain commit {commit}");
return commitObj;
//return commitObj
// ?? throw new AutoDeepenException($"Deepened repo did not contain commit {commit}");
}

/// <inheritdoc/>
Expand Down

0 comments on commit cc23a4e

Please sign in to comment.