diff --git a/src/WingetCreateCore/Common/Exceptions/NonFastForwardException.cs b/src/WingetCreateCore/Common/Exceptions/NonFastForwardException.cs deleted file mode 100644 index 75e8bebf..00000000 --- a/src/WingetCreateCore/Common/Exceptions/NonFastForwardException.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. -// Licensed under the MIT license. - -namespace Microsoft.WingetCreateCore.Common.Exceptions -{ - using System; - - /// - /// The exception that is thrown when attemping a non-fast forward update to a GitHub repository branch. - /// - public class NonFastForwardException : Exception - { - /// - /// Initializes a new instance of the class. - /// - /// The number of commits the branch is ahead by. - public NonFastForwardException(int commitsAheadBy) - { - this.CommitsAheadBy = commitsAheadBy; - } - - /// - /// Gets the number of commits the branch is ahead by. - /// - public int CommitsAheadBy { get; private set; } - } -} diff --git a/src/WingetCreateCore/Common/GitHub.cs b/src/WingetCreateCore/Common/GitHub.cs index bb8553e3..5767ced3 100644 --- a/src/WingetCreateCore/Common/GitHub.cs +++ b/src/WingetCreateCore/Common/GitHub.cs @@ -340,7 +340,6 @@ private async Task SubmitPRAsync(string packageId, string version, { var retryPolicy = Policy .Handle() - .Or() .Or() .WaitAndRetryAsync(3, i => TimeSpan.FromSeconds(i)); @@ -349,9 +348,6 @@ await retryPolicy.ExecuteAsync(async () => // Related issue: https://github.com/microsoft/winget-create/issues/282 // There is a known issue where a reference is unable to be created if the fork is behind by too many commits. // Always attempt to sync fork in order to mitigate the possibility of this scenario occurring. - // If the fork is behind by too many commits, syncing will also fail with a NotFoundException. - // Updating the fork can fail if it is a non-fast forward update, but this should not be blocking as pull request submission can still proceed. - // If creating a reference fails, that means syncing the fork also failed, therefore the user will need to manually sync their repo regardless. if (submitToFork) { await this.UpdateForkedRepoWithUpstreamCommits(repo); @@ -475,15 +471,8 @@ private async Task UpdateForkedRepoWithUpstreamCommits(Repository forkedRepo) var upstream = forkedRepo.Parent; var compareResult = await this.github.Repository.Commit.Compare(upstream.Id, upstream.DefaultBranch, $"{forkedRepo.Owner.Login}:{forkedRepo.DefaultBranch}"); - // Check to ensure that the update is only a fast-forward update. if (compareResult.BehindBy > 0) { - int commitsAheadBy = compareResult.AheadBy; - if (commitsAheadBy > 0) - { - throw new NonFastForwardException(commitsAheadBy); - } - // Octokit .NET doesn't support sync fork endpoint, so we make a direct call to the GitHub API. // Tracking issue for the request: https://github.com/octokit/octokit.net/issues/2989 HttpClient httpClient = new HttpClient();