-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Fix pull request update showing too many commits with multiple branches #22856
Conversation
When the base repository contains multiple branches with the same commits as the base branch, pull requests can show a long list of commits already in the base branch as having been added. What this is supposed to do is exclude commits already in the base branch. But the mechanism to do so assumed a commit only exists in a single branch. Now use `git rev-list A B --not branchName` instead of filtering commits afterwards. The logic to detect if there was a force push also was wrong for multiple branches. If the old commit existed in any branch in the base repository it would assume there was no force push. Instead check if the old commit is an ancestor of the new commit.
An example of this problem can be seen here: |
ba8dd2b
to
aca89c9
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
We have a function named |
The IsBranch() test is no longer part of IsForcePush(), because the code path this is called in already tests opts.IsBranch() and forced updates are not just a thing in branches.
From what I can tell the commands are equivalent, with
|
🎺 🤖 |
* giteaofficial/main: Improve squash merge commit author and co-author with private emails (go-gitea#22977) Fix broken Chroma CSS styles (go-gitea#23174) Add gradle samples in maven doc of packages (go-gitea#23374) Fix and move "Use this template" button (go-gitea#23398) [skip ci] Updated translations via Crowdin Add init file for Ubuntu (go-gitea#23362) Rename `canWriteUnit` to `canWriteProjects` (go-gitea#23386) Fix pull request update showing too many commits with multiple branches (go-gitea#22856) Fix incorrect NotFound conditions in org/projects.go (go-gitea#23384) Refactor merge/update git command calls (go-gitea#23366) Redirect to project again after editing it (go-gitea#23326) Add Gitea Community Code of Conduct (go-gitea#23188)
When the base repository contains multiple branches with the same commits as the base branch, pull requests can show a long list of commits already in the base branch as having been added.
What this is supposed to do is exclude commits already in the base branch. But the mechansim to do so assumed a commit only exists in a single branch. Now use
git rev-list A B --not branchName
instead of filtering commits afterwards.The logic to detect if there was a force push also was wrong for multiple branches. If the old commit existed in any branch in the base repository it would assume there was no force push. Instead check if the old commit is an ancestor of the new commit.