Codeowner change detection doesn't work for outdated branches #12052

Closed
opened 2025-11-02 09:56:14 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @otbutz on GitHub (Nov 20, 2023).

Description

If the branch of a pull request is behind its target branch, any changes from missing commits on the target branch will also trigger their associated rules.

The codeowner detection should rather be based on the actual diff output that is shown in the pull request page.

Gitea Version

1.21.0

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Binary started via systemd behind a caddy reverse proxy.

Database

None

Originally created by @otbutz on GitHub (Nov 20, 2023). ### Description If the branch of a pull request is behind its target branch, any changes from missing commits on the target branch will also trigger their associated rules. The codeowner detection should rather be based on the actual diff output that is shown in the pull request page. ### Gitea Version 1.21.0 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? Binary started via systemd behind a caddy reverse proxy. ### Database None
GiteaMirror added the type/bug label 2025-11-02 09:56:14 -06:00
Author
Owner

@bt90 commented on GitHub (Nov 20, 2023):

@cl-bvl I wonder if this intentional behaviour or should the list of files be computed from the actual diff?

@bt90 commented on GitHub (Nov 20, 2023): @cl-bvl I wonder if this intentional behaviour or should the list of files be computed from the actual diff?
Author
Owner

@m3rtl commented on GitHub (Feb 5, 2024):

Is there anything new on this?

@m3rtl commented on GitHub (Feb 5, 2024): Is there anything new on this?
Author
Owner

@zowers commented on GitHub (Feb 27, 2024):

owners of files unrelated to the PR are notified, please consider fixing

@zowers commented on GitHub (Feb 27, 2024): owners of files unrelated to the PR are notified, please consider fixing
Author
Owner

@zowers commented on GitHub (Feb 27, 2024):

Caused by how list of changed files is computed: between base branch and pr branch

	changedFiles, err := repo.GetFilesChangedBetween(git.BranchPrefix+pr.BaseBranch, pr.GetGitRefName())

here:
https://github.com/go-gitea/gitea/pull/24910/files#diff-bc78d680355495193dadf6796c153e5f1bf55e91c3005e0c3055ee72a7fe2c7cR931 (#24921 )

same in main: 0900c1552b/models/issues/pull.go (L925)

probably pr.HeadCommitID must be used instead of git.BranchPrefix+pr.BaseBranch

@zowers commented on GitHub (Feb 27, 2024): Caused by how list of changed files is computed: between base branch and pr branch ```go changedFiles, err := repo.GetFilesChangedBetween(git.BranchPrefix+pr.BaseBranch, pr.GetGitRefName()) ``` here: https://github.com/go-gitea/gitea/pull/24910/files#diff-bc78d680355495193dadf6796c153e5f1bf55e91c3005e0c3055ee72a7fe2c7cR931 (#24921 ) same in main: https://github.com/go-gitea/gitea/blob/0900c1552b51c5d1d883bd3662e67891a5dac80d/models/issues/pull.go#L925 probably `pr.HeadCommitID` must be used instead of `git.BranchPrefix+pr.BaseBranch`
Author
Owner

@lunny commented on GitHub (Mar 27, 2024):

This has been resolved by #29783

@lunny commented on GitHub (Mar 27, 2024): This has been resolved by #29783
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12052