Gitea: 500 Internal server error when trying to merge a pull request

Created on 9 Sep 2019  路  14Comments  路  Source: go-gitea/gitea

  • Gitea version: 19.3
  • Git version: 1.8.3.1
  • Operating system: RHEL 7.6
  • Database:

    • [ ] PostgreSQL

    • [ ] MySQL

    • [ ] MSSQL

    • [x] SQLite

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

    • [ ] Yes (provide example URL)

    • [ ] No

    • [x] Not relevant

Description

When trying to automatically merge a pull request, the following error occurs

2019/09/09 13:02:07 routers/repo/pull.go:629:MergePullRequest() [E] Merge: getDiffTree: git diff-tree [/opt/gitea/data/tmp/local-repo/merge-11476913.git base:master head:head_repo/remove_readme]: fatal: bad revision 'head_repo/remove_readme'

_Originally posted by @rmbleeker in https://github.com/go-gitea/gitea/issues/8029#issuecomment-529423708_

kinenhancement

Most helpful comment

I upgraded git version 2.16.5 and it works now 馃槃

All 14 comments

I tested the git diff-tree command at the terminal with different combinations of branch names, and it works fine. So, it is probably not related to how the branches are named. The integration tests have covered the function. It should work for at least some cases.

Are there any notable differences about the PR? Does the function always fail for all PRs (or any success)?
Does it work using a newer version of Git?

For info, head_repo is a temporary name the Merge() function uses for the temporary repo it creates.

Strange thing, the fetch command before the getDiffTree() doesn't fail.

The whole sequence is pretty straightforward.

Is it possible that something particular is happening to /opt/gitea/data/tmp?

I am able to reproduce the error by using Git 1.8.3.4

Steps:

  1. download the Git tarball and build it at some location
  2. Add the PATH option at the [git] section in integrations/sqlite.ini
  3. make test-sqlite#Pull

I tested it with Git v1.8.5.6 and onward and they all pass the tests. The problem has been fixed since the version.

@typeless the available version of Git in the default RHEL7 repos is 1.8.3.1. You are saying that the issue here is with that version of git, not with Gitea? In that case the best course of action is probably to enable the SCL and use one of the versions of git available in there.

@rmbleeker

the available version of Git in the default RHEL7 repos is 1.8.3.1. You are saying that the issue here is with that version of git, not with Gitea?

Yes. The exact version that can pass the tests is 1.8.4 and onward as far as I can tell.

Even with rh-git-2.18 from the Red Hat SCL, which is git 2.18.1, I'm getting the exact same error. On top of that when I git push, Gitea now complains that the git executable is not found in $PATH, even though I've configured the path in the app.ini and the correct git version shows up in the configuration page on the web interface.

@rmbleeker
Not sure about your setup, but to be specific the app.ini entry I added is

[git]
PATH = /my/git/absolute/path/git

I have tested with many different versions of git built from source.
If possible, please run the integration tests such as I described in the above comment earlier,
to make sure that what I have reproduced is the same problem.

UPDATE: you don't need to build Git from source like I did if you are going to run the tests. Just using the rh-2.18 and the default 1.8.3.1 is okay.

After some further investigations, I found that

  • with git 1.8.3.4
From /home/typeless/src/code.gitea.io/gitea/integrations/gitea-integration-sqlite/gitea-repositories/user1/repo1
 * branch            master     -> FETCH_HEAD
  • with git 2.23.0
From /home/typeless/src/code.gitea.io/gitea/integrations/gitea-integration-sqlite/gitea-repositories/user1/repo1
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> head_repo/master

I am looking for some flags that make the behavior consistent.

I suppose it is related to https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.4.txt#L226-L232

I am unable to merge any PRs!
Git version: 1.8.3.1
Gitea: 1.9.3

I upgraded git version 2.16.5 and it works now 馃槃

This now works with git 1.8.3.1 on RedHat 7.6 as well.

I do recommend if you can upgrading git - git 2 has a number of features that can speed things up.

I had same issue, for me removing the content of the protect_branch and protected_branch Table in the gittea Database Table fixed it

Was this page helpful?
0 / 5 - 0 ratings