Gitea: Dashboard showing duplicate commits

Created on 15 Apr 2019  ·  22Comments  ·  Source: go-gitea/gitea

  • Gitea version (or commit ref): b04a1d9d6
  • Git version: 2.11.0
  • Operating system: DietPi, based on Raspbian GNU/Linux 9 (stretch)
  • Database (use [x]):

    • [x] PostgreSQL

    • [ ] MySQL

    • [ ] MSSQL

    • [ ] SQLite

  • Can you reproduce the bug at https://try.gitea.io:

    • [ ] Yes (provide example URL)

    • [ ] No

    • [x] Not relevant

  • Log gist:

Description

Commits shown are duplicated on the dashboard (not actually duplicated, it just looks like it) in the following way:

  1. Start editing a file within your repository on Gitea.
  2. E.g. add another file to the repository and commit the change.
  3. E.g. edit another file on this repository and commit the change.
  4. Finish editing the very first file and commit the change.

If you do something like that, then the third commit will include all these previous commits that happened during the edition of the first file, on the dashboard.

Screenshots

2019-04-15 17_17_47-Gitea-bug_A

kinbug revieweconfirmed

Most helpful comment

@‍stale nope

All 22 comments

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@‍stale nope

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@‍stale still nope

@andreymal @Akito13 could you test v1.9.1 fixed that? There is a bug duplicated webhooks fixed on v1.9.1 maybe it's related.

@lunny still present in v1.9.1 (didn't test v1.9.3 yet)

@andreymal old ones that was already duplicated won't go away. It should not happen anymore for new commits with latest version

@lafriks this is not old, this happened 6 days ago with gitea v1.9.1

@lafriks tried v1.9.3 right now — still happens

@lafriks Could this problem be related to this? (follow the comment)

Could be, hard to tell

Have you tried to Resynchronize pre-receive, update and post-receive hooks of all repositories. on your admin panel.

Update 2019|22|21

Since a couple dozen commits to Gitea this issue happens all the time when commiting from the WebUI. No matter the conditions. It does not matter anymore, if other files are already open or not.

What version of Gitea? Could you try on 1.10?

Just double check that you haven't got two Gitea hooks in your Gitea repositories?

@zeripath

Since a couple dozen commits to Gitea

As in I used a couple of the most recent versions of Gitea from the past weeks.

I also did not set up any Hooks manually. Even so, I still checked and I don't see any duplicate hooks.

@zeripath check my comment here. I think this may be the cause.

I'm still having this with v1.11.1, I just noticed that somehow I have duplicate hooks scripts on my Gitea server.

/home/git/gitea-repositories/user/my-repo.git/hooks $ ls post-receive.d
gitea  post-receive

/home/git/gitea-repositories/user/my-repo.git/hooks > $ cat post-receive.d/*
#!/usr/bin/env bash
"/home/git/gitea/gitea" hook --config='/home/git/gitea/custom/conf/app.ini' post-receive
#!/usr/bin/env bash
"/home/git/gitea/gitea" hook --config='/home/git/gitea/custom/conf/app.ini' post-receive

Not sure how that happened but I'm guessing that removing one of those in all of my repos will fix it. I think I had to do this before when migrating from Gogs, not sure when these hooks got duplicated.

@4oo4 Post your results, when you are done applying the possible fix.

The good ones are those named gitea. You should have:

$ find hooks ! -name '*.sample' -type f
hooks/pre-receive.d/gitea     // Gitea's pre-receive hook
hooks/pre-receive             // Cycles through hooks inside hooks/pre-receive.d/
hooks/update.d/gitea          // Gitea's update hook
hooks/update                  // Cycles through hooks inside hooks/update.d/
hooks/post-receive.d/gitea    // Gitea's post-receive hook
hooks/post-receive            // Cycles through hooks inside hooks/post-receive.d/

(You can ignore the .sample hooks, which have no effect).

Please be aware that there could also be some other hooks placed by repository owners as long as you enabled them.

@theAkito That fixed it for me. Basically in my hooks/pre-receive.d and hooks/post-receive.d folders in each repo, there was a duplicate post-recieve or pre-receive hook, and like @guillep2k says I kept the ones named gitea as the good ones.

To fix them en masse, first cd to your folder where you store your gitea repositories. Then this one liner will find those duplicates and get rid of them while keeping the good ones. not sure what that would do for custom user hooks though, could those possibly be named either pre-receive or post-receive?

find . -regextype egrep -regex ".*/*.git/hooks/(pre|post)-receive.d/(pre|post)-receive" -exec sudo rm {} \;

Obviously you want to back up your repositories directory before running that. Then, when I committed to a repo that had the duplicate hooks, it only displayed once in the dashboard. I didn't realize it until now but for a while the duplicate ones were also giving me duplicate messages in the terminal when I ran git push to sync my repos. That's fixed now too.

Seems like this is related to this. Perbe being the root cause of this.

@4oo4

I fixed it like this, though your way of handling the issue probably applies to a greater audience.

Since this fixed it for us, I consider this issue closed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  ·  3Comments

jonasfranz picture jonasfranz  ·  3Comments

flozz picture flozz  ·  3Comments

mirhec picture mirhec  ·  3Comments

lunny picture lunny  ·  3Comments