Branch create event shows up as newer than push in user timeline #14754

Open
opened 2025-11-02 11:22:05 -06:00 by GiteaMirror · 2 comments
Owner

Originally created by @SpeedyCraftah on GitHub (Jul 13, 2025).

Description

I'm not sure if this is just a quirk in how Git works and is expected, but whenever I (locally) create a branch based off of a specific commit hash (likely based on anything), commit a change and then push everything to remote, in the Gitea user dashboard timeline the branch creation shows up as the latest entry while the commit I pushed shows up right before it (aka older). I was able to reproduce this consistently both on my older 1.24.0 Gitea instance and the newer demo.gitea.com instance.

A very minor issue but I'm very detail orientated 😅.

Gitea Version

1.24.0

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

Image

Logically the branch create event should show up before the push to that new branch?

If it is of any use, the ISO timestamps of both events as shown on the Gitea dashboard:
Push to test-branch: 2025-07-13T10:16:12Z
Branch creation: 2025-07-13T10:16:12Z

Maybe this is because on the UI level Gitea doesn't care about the exact timing and instead only displays the events on a second-level, causing the branch creation to show up as newer (per some magic sorting rules)?

Git Version

2.49.0

Operating System

No response

How are you running Gitea?

Self hosted rootless docker container image running under Podman.

Database

SQLite

Originally created by @SpeedyCraftah on GitHub (Jul 13, 2025). ### Description I'm not sure if this is just a quirk in how Git works and is expected, but whenever I (locally) create a branch based off of a specific commit hash (likely based on anything), commit a change and then push everything to remote, in the Gitea user dashboard timeline the branch creation shows up as the latest entry while the commit I pushed shows up right before it (aka older). I was able to reproduce this consistently both on my older 1.24.0 Gitea instance and the newer `demo.gitea.com` instance. A very minor issue but I'm very detail orientated 😅. ### Gitea Version 1.24.0 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots <img width="646" height="228" alt="Image" src="https://github.com/user-attachments/assets/13b944a4-7092-4eb7-aee0-7d4ea9dd9227" /> Logically the branch create event should show up before the push to that new branch? If it is of any use, the ISO timestamps of both events as shown on the Gitea dashboard: Push to test-branch: 2025-07-13T10:16:12Z Branch creation: 2025-07-13T10:16:12Z Maybe this is because on the UI level Gitea doesn't care about the exact timing and instead only displays the events on a second-level, causing the branch creation to show up as newer (per some magic sorting rules)? ### Git Version 2.49.0 ### Operating System _No response_ ### How are you running Gitea? Self hosted rootless docker container image running under Podman. ### Database SQLite
GiteaMirror added the type/bug label 2025-11-02 11:22:05 -06:00
Author
Owner

@AdamMajer commented on GitHub (Jul 14, 2025):

In git, you push some commits, then you push the refs to these commits, then you update tracking branches. If the commits are associated with branches, it's logical that you push the commits first ... then you push the branch names ... which relabels the push to the branch ... then branch creation happens. For example:

Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 8 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 261 bytes | 261.00 KiB/s, done.
Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 (from 0)
To /home/adamm/work/gitea
 * [new branch]            foo -> foo
updating local tracking ref 'refs/remotes/origin/foo'

As you see here, writing objects is prior to branch creation happening.

You cannot create a branch and then push to it. The branch doesn't exist without the commits that define it 😉

@AdamMajer commented on GitHub (Jul 14, 2025): In git, you push some commits, then you push the refs to these commits, then you update tracking branches. If the commits are associated with branches, it's logical that you push the commits first ... then you push the branch names ... which relabels the push to the branch ... then branch creation happens. For example: ``` Enumerating objects: 4, done. Counting objects: 100% (4/4), done. Delta compression using up to 8 threads Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 261 bytes | 261.00 KiB/s, done. Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 (from 0) To /home/adamm/work/gitea * [new branch] foo -> foo updating local tracking ref 'refs/remotes/origin/foo' ``` As you see here, writing objects is prior to branch creation happening. You cannot create a branch and then push to it. The branch doesn't exist without the commits that define it 😉
Author
Owner

@lunny commented on GitHub (Jul 14, 2025):

I tink we just need to adjust the order of the two events here in services/repository/push.go

Image

This isn’t the correct location—it’s intended for tag pushes. The current implementation appears to use the correct order.

@lunny commented on GitHub (Jul 14, 2025): I tink we just need to adjust the order of the two events here in `services/repository/push.go` <img width="882" height="223" alt="Image" src="https://github.com/user-attachments/assets/ffe0e9f8-5264-46e2-aa3f-9df661203600" /> This isn’t the correct location—it’s intended for tag pushes. The current implementation appears to use the correct order.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#14754