Skip to content
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

Get commits of a pull request #10918 #12118

Conversation

AndrewBezold
Copy link
Contributor

Add an API endpoint to get commits of a pull request, similar to Github's.
Proposed endpoint is GET /repos/{owner}/{repo}/pulls/{index}/commits

Fix #10918

@lunny lunny added the modifies/api This PR adds API routes or modifies them label Jul 2, 2020
ctx.InternalServerError(err)
return
}
if err := pr.LoadHeadRepo(); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

In fact, head repository may missed, but we should still allow to get the pull request commits.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're correct, and in fact headRepo isn't used from what I can see. Removing that section.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 2, 2020
apiCommits := make([]*api.Commit, commits.Len())

i := 0
for commitPointer := commits.Front(); commitPointer != nil; commitPointer = commitPointer.Next() {
Copy link
Member

Choose a reason for hiding this comment

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

How did you do the pagination?

@6543
Copy link
Member

6543 commented Jul 16, 2020

--- FAIL: TestSearchRepository (0.08s)
    --- FAIL: TestSearchRepository/AllPublic/PublicRepositoriesOfUserIncludingCollaborative (0.00s)
        repo_list_test.go:213: 
            	Error Trace:	repo_list_test.go:213
            	Error:      	Not equal: 
            	            	expected: 25
            	            	actual  : 26
            	Test:       	TestSearchRepository/AllPublic/PublicRepositoriesOfUserIncludingCollaborative
    --- FAIL: TestSearchRepository/AllPublic/PublicAndPrivateRepositoriesOfUserIncludingCollaborative (0.00s)
        repo_list_test.go:213: 
            	Error Trace:	repo_list_test.go:213
            	Error:      	Not equal: 
            	            	expected: 30
            	            	actual  : 31
            	Test:       	TestSearchRepository/AllPublic/PublicAndPrivateRepositoriesOfUserIncludingCollaborative
    --- FAIL: TestSearchRepository/AllPublic/PublicRepositoriesOfOrganization (0.00s)
        repo_list_test.go:213: 
            	Error Trace:	repo_list_test.go:213
            	Error:      	Not equal: 
            	            	expected: 25
            	            	actual  : 26
            	Test:       	TestSearchRepository/AllPublic/PublicRepositoriesOfOrganization

@6543
Copy link
Member

6543 commented Jul 16, 2020

api_issue_test.go:156: Error: should have 9 item(s), but has 10
api_issue_test.go:164 Error: should have 9 item(s), but has 10
api_issue_test.go:171 Error: should have 2 item(s), but has 4
api_issue_test.go:185 Error: should have 1 item(s), but has 4
...

@a1012112796
Copy link
Member

Why not use existing test repos?

assert.NoError(t, pullIssue.LoadIssue())
repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: pullIssue.HeadRepoID}).(*models.Repository)

// test ListPullReviews
Copy link
Member

Choose a reason for hiding this comment

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

?

@6543
Copy link
Member

6543 commented Aug 2, 2020

@AndrewBezold I think you should just use the existing testdata

@stale
Copy link

stale bot commented Oct 3, 2020

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 months. Thank you for your contributions.

@stale stale bot added the issue/stale label Oct 3, 2020
@stale
Copy link

stale bot commented Dec 26, 2020

This pull request has been automatically closed because of inactivity. You can re-open it if needed.

@stale stale bot closed this Dec 26, 2020
@go-gitea go-gitea locked and limited conversation to collaborators Feb 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/stale lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/api This PR adds API routes or modifies them
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] [API ] Get Commits of a PullRequest
5 participants