-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Fix the handling of closed PR when push commits #23830
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wolfogre
reviewed
Mar 31, 2023
GiteaBot
added
lgtm/need 2
This PR needs two approvals by maintainers to be considered for merging.
labels
Mar 31, 2023
silverwind
reviewed
Mar 31, 2023
Co-authored-by: Jason Song <[email protected]>
Co-authored-by: Jason Song <[email protected]>
Co-authored-by: Jason Song <[email protected]>
Co-authored-by: silverwind <[email protected]>
wolfogre
approved these changes
Mar 31, 2023
GiteaBot
added
lgtm/need 1
This PR needs approval from one additional maintainer to be merged.
and removed
lgtm/need 2
This PR needs two approvals by maintainers to be considered for merging.
labels
Mar 31, 2023
lunny
reviewed
Apr 1, 2023
} | ||
prHeadCommitID, err := git.GetFullCommitID(ctx, pull.BaseRepo.RepoPath(), prHeadRef) | ||
if err != nil { | ||
ctx.ServerError("Get head commit Id fail", err) |
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.
Should we return 500 directly? Maybe just returning a flash with error is better.
lunny
reviewed
Apr 1, 2023
defer closer.Close() | ||
ok, err := baseRepo.IsCommitInBranch(prHeadCommitID, pull.BaseBranch) | ||
if err != nil { | ||
ctx.ServerError("", err) |
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.
As above.
sillyguodong
changed the title
Fix the handing of closed PR when push commits
Fix the handling of closed PR when push commits
Apr 3, 2023
replaced by #24231 |
lunny
pushed a commit
that referenced
this pull request
May 8, 2023
Close #24213 Replace #23830 #### Cause - Before, in order to making PR can get latest commit after reopening, the `ref`(${REPO_PATH}/refs/pull/${PR_INDEX}/head) of evrey closed PR will be updated when pushing commits to the `head branch` of the closed PR. #### Changes - For closed PR , won't perform these behavior: insert`comment`, push `notification` (UI and email), exectue [pushToBaseRepo](https://github.com/go-gitea/gitea/blob/74225033413dc0f2b308bbe069f6d185b551e364/services/pull/pull.go#L409) function and trigger `action` any more when pushing to the `head branch` of the closed PR. - Refresh the reference of the PR when reopening the closed PR (**even if the head branch has been deleted before**). Make the reference of PR consistent with the `head branch`.
GiteaBot
pushed a commit
to GiteaBot/gitea
that referenced
this pull request
May 8, 2023
Close go-gitea#24213 Replace go-gitea#23830 #### Cause - Before, in order to making PR can get latest commit after reopening, the `ref`(${REPO_PATH}/refs/pull/${PR_INDEX}/head) of evrey closed PR will be updated when pushing commits to the `head branch` of the closed PR. #### Changes - For closed PR , won't perform these behavior: insert`comment`, push `notification` (UI and email), exectue [pushToBaseRepo](https://github.com/go-gitea/gitea/blob/74225033413dc0f2b308bbe069f6d185b551e364/services/pull/pull.go#L409) function and trigger `action` any more when pushing to the `head branch` of the closed PR. - Refresh the reference of the PR when reopening the closed PR (**even if the head branch has been deleted before**). Make the reference of PR consistent with the `head branch`.
silverwind
pushed a commit
that referenced
this pull request
May 8, 2023
Backport #24231 by @sillyguodong Close #24213 Replace #23830 #### Cause - Before, in order to making PR can get latest commit after reopening, the `ref`(${REPO_PATH}/refs/pull/${PR_INDEX}/head) of evrey closed PR will be updated when pushing commits to the `head branch` of the closed PR. #### Changes - For closed PR , won't perform these behavior: insert`comment`, push `notification` (UI and email), exectue [pushToBaseRepo](https://github.com/go-gitea/gitea/blob/74225033413dc0f2b308bbe069f6d185b551e364/services/pull/pull.go#L409) function and trigger `action` any more when pushing to the `head branch` of the closed PR. - Refresh the reference of the PR when reopening the closed PR (**even if the head branch has been deleted before**). Make the reference of PR consistent with the `head branch`. Co-authored-by: sillyguodong <[email protected]>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
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.
After #23189 be mergerd, casue some issues, like #23707, #23440.
This PR is mainly to improve the handling of closed PR.
Changes
comment
, pushnotification
(UI and email), exectue pushToBaseRepo func and triggeraction
. But not all of these behaviour have to be performed in different cases.action
, not pushnotification
comment
and executepushToBaseRepo()
comment
(if reopen the PR, display in the UI), executepushToBaseRepo()
(pushes commits to the base branch of the base repo)