Skip to content

Conversation

ghost
Copy link

@ghost ghost commented Oct 1, 2022

Currently, webhook notifications list commits in reverse order, which is probably an unintended side effect of the CommitsBefore* functions returning commits from newest to oldest, and is also generally unnatural when new events come in from top to bottom, which is probably the case on most if not all supported platforms (Discord, Telegram, etc.). This PR reverses the returned commits to put them in forward order, which also makes it consistent with GitHub and GitLab's official webhooks.

Closes #21252.

@wxiaoguang
Copy link
Contributor

Thank you for the PR. I am neutral for it. However, the reverse order (desc) is the default output order for git log and most git eco-system tools.

I am not sure whether there are enough people like the forward(asc) order. If there are, I can vote my approval if the PR doesn't cause other problems. For example, this PR changes the order, it also affects UpdateIssuesCommit, which also depends on the commit order, and the code below commits.Commits[len(commits.Commits)-1] also depends the order, they all seem broken after this PR.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Oct 10, 2022
@ghost
Copy link
Author

ghost commented Oct 10, 2022

However, the reverse order (desc) is the default output order for git log and most git eco-system tools.

Yes, but in that case you're scrolling through a constant stream of commit messages and the order remains consistent throughout. With webhooks as I said that's generally not the case, perhaps with a few exceptions such as if you were to pipe notifications to a push notification service like Pushover.

For example, this PR changes the order, it also affects UpdateIssuesCommit, which also depends on the commit order, and the code below commits.Commits[len(commits.Commits)-1] also depends the order, they all seem broken after this PR.

Hmm, I didn't catch this on my small local deployment so far. I can probably fix it to only reverse the order for the webhook messages.

@wxiaoguang wxiaoguang added the issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail label Apr 25, 2023
@wxiaoguang
Copy link
Contributor

Is this PR active? If no strong requirement and it gets stale, maybe ..... close?

@wxiaoguang
Copy link
Contributor

It has been stale for a long time and I can't think of a way to handling it other than closing it. Feel free to reopen if there's any new progress and I could also help.

@wxiaoguang wxiaoguang closed this May 1, 2023
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Aug 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't reverse order of commits in webhooks
3 participants