diff --git a/src/Verlite.Core/GitRepoInspector.cs b/src/Verlite.Core/GitRepoInspector.cs index e60bff4..9ff9e79 100644 --- a/src/Verlite.Core/GitRepoInspector.cs +++ b/src/Verlite.Core/GitRepoInspector.cs @@ -426,11 +426,18 @@ private async Task 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}"); } ///