Skip to content

Fix pull file view when single commit selected #35184

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

Closed

Conversation

badhezi
Copy link
Contributor

@badhezi badhezi commented Jul 30, 2025

attempt to address #35157

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 30, 2025
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Jul 30, 2025
@badhezi badhezi marked this pull request as draft July 30, 2025 14:58
@badhezi badhezi marked this pull request as ready for review July 30, 2025 15:59
@lunny lunny added the type/bug label Jul 31, 2025
@@ -746,7 +746,24 @@ func viewPullFiles(ctx *context.Context, specifiedStartCommit, specifiedEndCommi
WhitespaceBehavior: gitdiff.GetWhitespaceFlag(ctx.Data["WhitespaceBehavior"].(string)),
}

if !willShowSpecifiedCommit {
if willShowSpecifiedCommit {
// Attempt to extract parent of endCommit when viewing diff of a specific commit.
Copy link
Member

Choose a reason for hiding this comment

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

I think it's better to move the logic to line 716

@lunny
Copy link
Member

lunny commented Aug 1, 2025

@badhezi I wasn’t able to push to this pull request, so I’ve opened a new one: #35192. Most of the changes were extracted from my previous PR #35077. Apologies for the conflicts, and thank you again for your contributions!

lunny added a commit that referenced this pull request Aug 3, 2025
The commit range in the UI follows a half-open, half-closed convention:
(,]. When reviewing a range of commits, the beforeCommitID should be set
to the commit immediately preceding the first selected commit. For
single-commit reviews, we must identify and use the previous commit of
that specific commit.

The endpoint ViewPullFilesStartingFromCommit is currently unused and can
be safely removed.

Fix #35157 
Replace #35184 
Partially extract from #35077
@lunny lunny closed this Aug 3, 2025
lunny added a commit to lunny/gitea that referenced this pull request Aug 10, 2025
The commit range in the UI follows a half-open, half-closed convention:
(,]. When reviewing a range of commits, the beforeCommitID should be set
to the commit immediately preceding the first selected commit. For
single-commit reviews, we must identify and use the previous commit of
that specific commit.

The endpoint ViewPullFilesStartingFromCommit is currently unused and can
be safely removed.

Fix go-gitea#35157
Replace go-gitea#35184
Partially extract from go-gitea#35077
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/go Pull requests that update Go code type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants