-
-
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
Agit flow add refs/for-review/<pull index> support #33179
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: a1012112796 <[email protected]>
Signed-off-by: a1012112796 <[email protected]>
Signed-off-by: a1012112796 <[email protected]>
# Conflicts: # modules/git/git.go # services/agit/agit.go # templates/repo/issue/view_content/sidebar.tmpl
This PR is ready for review. |
return fmt.Errorf("Internal Server Error (no specific error)") | ||
} | ||
|
||
if ctx.userPerm.CanWrite(unit.TypeCode) { |
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.
user with read permission to the code should be allowed to create/update pull requests?
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.
Updating pull requests requires write permission.
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.
Updating pull requests needs write permission of the head repository.
@@ -236,7 +236,8 @@ func runServ(c *cli.Context) error { | |||
if git.DefaultFeatures().SupportProcReceive { | |||
// for AGit Flow | |||
if cmd == "ssh_info" { | |||
fmt.Print(`{"type":"gitea","version":1}`) | |||
data := private.GetSSHInfo(ctx) | |||
fmt.Println(data) |
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.
The "data" is always hard-coded string {"type":"gitea","version":2}
? Why it needs a http request
} | ||
|
||
if !ctx.loadPusherAndPermission() { | ||
return fmt.Errorf("Internal Server Error (no specific error)") |
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.
The error message seems not informative.
|
||
if err := canUpdateAgitPull(ctx, pull); err != nil { | ||
ctx.JSON(http.StatusForbidden, private.Response{ | ||
UserMsg: err.Error(), |
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.
We should avoid putting err.Error()
to UserMsag. At the moment, these messages are written by you, but in the future, developers might fill server-side sensitive information into it.
@@ -46,6 +125,49 @@ func ProcReceive(ctx context.Context, repo *repo_model.Repository, gitRepo *git. | |||
continue | |||
} | |||
|
|||
if opts.RefFullNames[i].IsForReview() { |
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.
This for-loop is too large to maintain. I think we need to split it into small functions (and it's easier to use unit test to cover the small functions)
@@ -1,5 +1,5 @@ | |||
{{if and .Issue.IsPull .IsIssuePoster (not .Issue.IsClosed) .Issue.PullRequest.HeadRepo}} | |||
{{if and (not (eq .Issue.PullRequest.HeadRepo.FullName .Issue.PullRequest.BaseRepo.FullName)) .CanWriteToHeadRepo}} | |||
{{if or (eq .SignedUserID .Issue.PosterID) (and (not (eq .Issue.PullRequest.HeadRepo.FullName .Issue.PullRequest.BaseRepo.FullName)) .CanWriteToHeadRepo)}} |
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 there anyone able to really understand the complex logic here?
The original PR is #31245. Thanks to @a1012112796 for everything you did for this pr. Since I haven't heard from the author for a long time, I decided to try to resolve the conflict.
How to update a pull request using agit?