CODEOWNERS test against diff towards HEAD of target branch instead of merge-base #12637

Closed
opened 2025-11-02 10:16:40 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @baronjeppe on GitHub (Mar 13, 2024).

Description

When a new PR is opened the CODEOWNERS functionality tests against the diff towards refs/heads/ as seen here:
https://github.com/go-gitea/gitea/blob/7fd0a5b276aadcf88dcc012fcd364fe160a58810/models/issues/pull.go#L920

This means that if the source branch for the PR is not up to date with the target the diff will contain all the changes added to the target branch since merge base - this seems like the wrong behavior to me.

I think it should use merge base instead of head - which i also assume is the logic used to determine which changes needs to be reviewed in a PR.

I am not familiar with the codebase of gitea, so i am not comfortable make the pr to change this, but if it is agreed that this change should be made, and nobody else has the bandwidth to do it, i might give it a try.

Gitea Version

1.21.8

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?

Not relevant

Database

MySQL/MariaDB

Originally created by @baronjeppe on GitHub (Mar 13, 2024). ### Description When a new PR is opened the CODEOWNERS functionality tests against the diff towards refs/heads/<target branch> as seen here: https://github.com/go-gitea/gitea/blob/7fd0a5b276aadcf88dcc012fcd364fe160a58810/models/issues/pull.go#L920 This means that if the source branch for the PR is not up to date with the target the diff will contain all the changes added to the target branch since merge base - this seems like the wrong behavior to me. I think it should use merge base instead of head - which i also assume is the logic used to determine which changes needs to be reviewed in a PR. I am not familiar with the codebase of gitea, so i am not comfortable make the pr to change this, but if it is agreed that this change should be made, and nobody else has the bandwidth to do it, i might give it a try. ### Gitea Version 1.21.8 ### 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? Not relevant ### Database MySQL/MariaDB
GiteaMirror added the type/bug label 2025-11-02 10:16:40 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12637