Gitea: Confusing information about the user who merged pull-request

Created on 13 Aug 2019  路  6Comments  路  Source: go-gitea/gitea

  • Gitea version (or commit ref): 1.9.0
  • Git version: 2.11.0
  • Operating system: Debian 9.9
  • Database (use [x]):

    • [ ] PostgreSQL

    • [x] MySQL

    • [ ] MSSQL

    • [ ] SQLite

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

    • [ ] Yes (provide example URL)

    • [ ] No

    • [ ] Not relevant

  • Log gist:

Description

When pull-request is merged, everything goes well, but the activity information states that the pull request was closed at the same time by both the user who actually did and the user who created the pull-request, which is confusing.

It started to happen after upgrade to 1.9.0.

Screenshots


https://mirror.git.trinitydesktop.org/gitea/TDE/gtk-qt-engine/pulls/2

kinbug revieweconfirmed

All 6 comments

Other examples - this time the same user is mentioned twice because the merge was performed by the same user who created the pull-request:

https://mirror.git.trinitydesktop.org/gitea/TDE/tdelibs/pulls/48
https://mirror.git.trinitydesktop.org/gitea/TDE/tdebase/pulls/56

We should display who merged the PR and the last commit id.

Another strange example: As the name of the user who closed the pull request is used the name of the organization:
https://mirror.git.trinitydesktop.org/gitea/TDE/tqt3/pulls/19

Apparently there is a race condition when the TestPullRequest() goroutine is closing the issue even when it was closed moments before. Here are my stack traces for a single merge (break point on changeStatus()):

First time :

code.gitea.io/gitea/models.(*Issue).changeStatus (\home\gprandi\src\code.gitea.io\gitea\models\issue.go:779)
code.gitea.io/gitea/models.(*PullRequest).SetMerged (\home\gprandi\src\code.gitea.io\gitea\models\pull.go:437)
code.gitea.io/gitea/modules/pull.Merge (\home\gprandi\src\code.gitea.io\gitea\modules\pull\merge.go:265)
code.gitea.io/gitea/routers/repo.MergePullRequest (\home\gprandi\src\code.gitea.io\gitea\routers\repo\pull.go:679)

Second time:

code.gitea.io/gitea/models.(*Issue).changeStatus (\home\gprandi\src\code.gitea.io\gitea\models\issue.go:724)
code.gitea.io/gitea/models.(*PullRequest).SetMerged (\home\gprandi\src\code.gitea.io\gitea\models\pull.go:437)
code.gitea.io/gitea/models.(*PullRequest).manuallyMerged (\home\gprandi\src\code.gitea.io\gitea\models\pull.go:477)
code.gitea.io/gitea/models.TestPullRequests (\home\gprandi\src\code.gitea.io\gitea\models\pull.go:1277)

I know #6233 is supposed to prevent changeStatus() from closing the issue twice, but the fact that there are two different transactions dealing with the same record makes them both see it as not closed. Some kind of lock should be used to prevent this.

I still don't quite understand the logic behind TestPullRequest() but in absence of another solution, it might be possible to prevent this if we make TestPullRequest() to ignore commits younger than 10 seconds or something like that.

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.

Issue is still valid for the current Gitea 1.10.0 release.

Was this page helpful?
0 / 5 - 0 ratings