Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Branches not at ref commit ID should not be listed as Merged #9614
Branches not at ref commit ID should not be listed as Merged #9614
Changes from 3 commits
93364b9
4af6395
84decfe
3db7335
6f8d95e
ba13b0f
a9d65b8
4c40b8e
d3a5b4b
6ebbe30
705420a
d6d2f87
cf502ac
d76f586
13175c0
c440e52
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can
pr.HeadRepo
benil
here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
~~Well... not the way I'd written the code... ~~
It can now.I'm an idiot. Of course it can't be...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 219 only gets the PRs by HeadInfo - that is those that are in the head repo. Therefore the head repo is always going to be the ctx.Repo.Repository.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this is an edge case and is covered elsewhere but, perhaps if we've got
ErrReferenceNotFound
we should hide thenew PR
button as well?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this referring to when I thought it was possible to not get the head branch commit id? We actually always know that's there because otherwise there would have been a ServerError at line 200. So that can't happen and I've optimised that check away.
OR
is this referring to if we can't find the PR pulls head in the base repo?
I'm not sure what to do in that case. If I try to enforce that the pulls head is actually there I suspect that will break a lot of integration tests - as our fixtures do not necessarily match the ground truth. I also expect that there is a race between the db and the presence of the pull head. (We should check what happens here - the index is needed to create the pull head - so that means that the db has to have a pull request committed before we can push to the pull head.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant that
MergeMovedOn
, which has a restrictive meaning, is only set to true if both heads are found, but the restriction (which is to hide theNew PR
button) still should apply if any of the heads is missing (ErrReferenceNotFound
). Maybe when any of the heads is missing it should also be set to true, but then its name should be changed because it will no longer reflect the exact scenario.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand.
Perhaps some of what you're discussing is already fixed within the logic of the template?
If you don't have a PR already then merge moved on is of no consequence.
The head branch we already know exists because it's the branch we've provided.
If the base branch does not exist - that's a server error - although this won't show that. You shouldn't be able to delete a branch with PRs against it - (although I haven't checked that.) If the git pull head isn't there well... that's technically a server error but I think there could be a race between between a pull request being made and the ref being updated so I think we should allow it.