[PR #88] [MERGED] Refactor CommitsBefore method to match github #94

Closed
opened 2026-02-16 10:24:05 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-gitea/git/pull/88
Author: @daviian
Created: 10/11/2017
Status: Merged
Merged: 12/10/2017
Merged by: @lafriks

Base: masterHead: refactor/allow-sorting


📝 Commits (2)

  • 24c0a0c refactored CommitsBefore method
  • d2765e6 add limit to getBranches

📊 Changes

1 file changed (+38 additions, -50 deletions)

View changed files

📝 repo_commit.go (+38 -50)

📄 Description

The CommitsBefore method is only used to retrieve commits for the push webhook if a new branch is pushed.
Namely at https://github.com/go-gitea/gitea/blob/a4cd4616c6f8524f8eb79d6184e855b3a8164130/models/update.go#L229

The refactored method now returns exactly those commits which were added in the new branch and are not existing in any other branch.
This result now behaves exactly as github (compared to the webhook result) except for the order.

The order will be fixed in a separate PR as there is another method which needs order fixing.
All these changes are necessary to implement https://github.com/go-gitea/gitea/pull/2548


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-gitea/git/pull/88 **Author:** [@daviian](https://github.com/daviian) **Created:** 10/11/2017 **Status:** ✅ Merged **Merged:** 12/10/2017 **Merged by:** [@lafriks](https://github.com/lafriks) **Base:** `master` ← **Head:** `refactor/allow-sorting` --- ### 📝 Commits (2) - [`24c0a0c`](https://github.com/go-gitea/git/commit/24c0a0c11aefcc5902a180ba4f0e3e8a27bd1a48) refactored CommitsBefore method - [`d2765e6`](https://github.com/go-gitea/git/commit/d2765e6a4bc6cdf5269b68f4ae19afe7c54ed3cf) add limit to getBranches ### 📊 Changes **1 file changed** (+38 additions, -50 deletions) <details> <summary>View changed files</summary> 📝 `repo_commit.go` (+38 -50) </details> ### 📄 Description The CommitsBefore method is `only` used to retrieve commits for the push webhook if a new branch is pushed. Namely at https://github.com/go-gitea/gitea/blob/a4cd4616c6f8524f8eb79d6184e855b3a8164130/models/update.go#L229 The refactored method now returns exactly those commits which were added in the new branch and are not existing in any other branch. This result now behaves exactly as github (compared to the webhook result) except for the order. The order will be fixed in a separate PR as there is another method which needs order fixing. All these changes are necessary to implement https://github.com/go-gitea/gitea/pull/2548 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-16 10:24:05 -05:00
yindo closed this issue 2026-02-16 10:24:05 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: go-gitea/git#94