Skip to content

Commit ce162d2

Browse files
authored
Don't check for commits ahead by when syncing fork (#616)
1 parent a26ec29 commit ce162d2

File tree

2 files changed

+0
-38
lines changed

2 files changed

+0
-38
lines changed

src/WingetCreateCore/Common/Exceptions/NonFastForwardException.cs

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/WingetCreateCore/Common/GitHub.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@ private async Task<PullRequest> SubmitPRAsync(string packageId, string version,
340340
{
341341
var retryPolicy = Policy
342342
.Handle<ApiException>()
343-
.Or<NonFastForwardException>()
344343
.Or<GenericSyncFailureException>()
345344
.WaitAndRetryAsync(3, i => TimeSpan.FromSeconds(i));
346345

@@ -349,9 +348,6 @@ await retryPolicy.ExecuteAsync(async () =>
349348
// Related issue: https://github.com/microsoft/winget-create/issues/282
350349
// There is a known issue where a reference is unable to be created if the fork is behind by too many commits.
351350
// Always attempt to sync fork in order to mitigate the possibility of this scenario occurring.
352-
// If the fork is behind by too many commits, syncing will also fail with a NotFoundException.
353-
// 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.
354-
// If creating a reference fails, that means syncing the fork also failed, therefore the user will need to manually sync their repo regardless.
355351
if (submitToFork)
356352
{
357353
await this.UpdateForkedRepoWithUpstreamCommits(repo);
@@ -475,15 +471,8 @@ private async Task UpdateForkedRepoWithUpstreamCommits(Repository forkedRepo)
475471
var upstream = forkedRepo.Parent;
476472
var compareResult = await this.github.Repository.Commit.Compare(upstream.Id, upstream.DefaultBranch, $"{forkedRepo.Owner.Login}:{forkedRepo.DefaultBranch}");
477473

478-
// Check to ensure that the update is only a fast-forward update.
479474
if (compareResult.BehindBy > 0)
480475
{
481-
int commitsAheadBy = compareResult.AheadBy;
482-
if (commitsAheadBy > 0)
483-
{
484-
throw new NonFastForwardException(commitsAheadBy);
485-
}
486-
487476
// Octokit .NET doesn't support sync fork endpoint, so we make a direct call to the GitHub API.
488477
// Tracking issue for the request: https://github.com/octokit/octokit.net/issues/2989
489478
HttpClient httpClient = new HttpClient();

0 commit comments

Comments
 (0)