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

500 Internal server error when trying to merge a pull request #8133

Closed
2 of 7 tasks
rmbleeker opened this issue Sep 9, 2019 · 14 comments · Fixed by #8161
Closed
2 of 7 tasks

500 Internal server error when trying to merge a pull request #8133

rmbleeker opened this issue Sep 9, 2019 · 14 comments · Fixed by #8161
Labels
type/enhancement An improvement of existing functionality

Comments

@rmbleeker
Copy link

rmbleeker commented Sep 9, 2019

  • Gitea version: 19.3
  • Git version: 1.8.3.1
  • Operating system: RHEL 7.6
  • Database:
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io
    • Yes (provide example URL)
    • No
    • 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 #8029 (comment)

@typeless
Copy link
Contributor

typeless commented Sep 9, 2019

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?

@guillep2k
Copy link
Member

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?

@typeless
Copy link
Contributor

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

@typeless
Copy link
Contributor

typeless commented Sep 10, 2019

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.

@rmbleeker
Copy link
Author

@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.

@typeless
Copy link
Contributor

typeless commented Sep 10, 2019

@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.

@rmbleeker
Copy link
Author

rmbleeker commented Sep 10, 2019

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.

@typeless
Copy link
Contributor

typeless commented Sep 10, 2019

@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.

@typeless
Copy link
Contributor

typeless commented Sep 12, 2019

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

@hanhpv
Copy link

hanhpv commented Sep 12, 2019

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

@hanhpv
Copy link

hanhpv commented Sep 12, 2019

I upgraded git version 2.16.5 and it works now 😄

@rmbleeker
Copy link
Author

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

@zeripath
Copy link
Contributor

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

@semasimo
Copy link

semasimo commented Dec 2, 2019

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

@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants