Skip to content

Fix pr checkout for PRs coming from deleted forks#3700

Merged
mislav merged 3 commits intotrunkfrom
pr-checkout-deleted
May 26, 2021
Merged

Fix pr checkout for PRs coming from deleted forks#3700
mislav merged 3 commits intotrunkfrom
pr-checkout-deleted

Conversation

@mislav
Copy link
Contributor

@mislav mislav commented May 24, 2021

Fixes #3696

Comment on lines +99 to +101
if pr.HeadRepository == nil {
headRemote = nil
} else if pr.IsCrossRepository {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a short circuit, correct? remotes.FindByRepo was previously returning nil when pr.HeadRepository == nil?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct! But now pr.HeadRepository.Name will crash when there is no head repository, so we have to guard against accessing it.

Copy link
Contributor

@samcoe samcoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@mislav mislav merged commit ece536a into trunk May 26, 2021
@mislav mislav deleted the pr-checkout-deleted branch May 26, 2021 10:59
@Wires77
Copy link

Wires77 commented Jul 18, 2024

Out of curiosity, why were the other tests moved to become legacy? Makes it impossible to test just one test now, right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gh pr checkout panics if the PR repo does not exist

4 participants