Skip to content
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

"Git hooks of this repository seem to be broken." warning when pushing more than one branch at a time #31140

Closed
matrss opened this issue May 28, 2024 · 0 comments · Fixed by #31151
Labels
Milestone

Comments

@matrss
Copy link

matrss commented May 28, 2024

Description

See the warning at the top of the screenshot included below.

Link to demo repository: https://demo.gitea.com/matrss/broken-hooks-demo

The issue is reproducible with the following git commands (adapt the clone URL and cd accordingly):

git clone git@demo.gitea.com:matrss/broken-hooks-demo.git
cd broken-hooks-demo
git commit --allow-empty -m "Initial commit"
git push
git switch -c a
git commit --allow-empty -m "commit on a"
sleep 1
git push origin a
git commit --allow-empty -m "another commit on a"
git switch main
git commit --allow-empty -m "commit on main"
sleep 1
git push origin main a

i.e. this warning appears when pushing more than one branch with a single git push.

If I remove the git push origin a in the middle from the above commands then the warning does not appear, but instead the "a" branch will not be shown in the web UI, even though git reports it as pushed and up-to-date. That is probably a related issue.

This issue was also reported to Forgejo here: https://codeberg.org/forgejo/forgejo/issues/3518 where I bisected the cause to be the changes made in #29493.

Gitea Version

1.23.0+dev-128-g14f6105ce0

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

Screenshot from 2024-05-28 16-41-12

Git Version

No response

Operating System

No response

How are you running Gitea?

https://demo.gitea.com/

Database

None

@lunny lunny added this to the 1.22.1 milestone May 29, 2024
lunny added a commit that referenced this issue May 30, 2024
Backport #31151 by @lunny

Fix #31140 

The previous logic is wrong when pushing multiple branches. After first
branch updated, it will ignore left other branches sync operations.

As a workaround for the repositories, just push a new commit after the
patch applied will fix the repositories status.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
@go-gitea go-gitea locked as resolved and limited conversation to collaborators Aug 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants