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 #8029

Closed
2 of 7 tasks
rmbleeker opened this issue Aug 29, 2019 · 8 comments · Fixed by #8066
Closed
2 of 7 tasks

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

rmbleeker opened this issue Aug 29, 2019 · 8 comments · Fixed by #8066
Labels
Milestone

Comments

@rmbleeker
Copy link

  • Gitea version: 1.9.2
  • Git version: 1.8.3.1
  • Operating system: RHEL 7.6
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant

Description

Steps to reproduce:

  • create a new branch
  • push branch
  • create a new pull request, it will be available to be merged automatically according to Gitea
  • clicking the "Merge Pull Request" button results in a 500 error

Log:

2019/08/28 15:30:20 routers/repo/pull.go:629:MergePullRequest() [E] Merge: getDiffTree: git diff-tree [/opt/gitea/data/tmp/local-repo/merge-911475386.git base:master head:head_repo/remove_readme]: fatal: ambiguous argument 'head_repo/remove_readme': unknown revision or path not in the working tree.
	Use '--' to separate paths from revisions, like this:
	'git <command> [<revision>...] -- [<file>...]'

Screenshot

gitea_500

@typeless
Copy link
Contributor

typeless commented Aug 31, 2019

I tried it with the integration test by applying the following change:

diff --git a/integrations/pull_merge_test.go b/integrations/pull_merge_test.go
index 27f9fc6bb..6cfcf7b53 100644
--- a/integrations/pull_merge_test.go
+++ b/integrations/pull_merge_test.go
@@ -60,9 +60,9 @@ func TestPullMerge(t *testing.T) {
 
                session := loginUser(t, "user1")
                testRepoFork(t, session, "user2", "repo1", "user1", "repo1")
-               testEditFile(t, session, "user1", "repo1", "master", "README.md", "Hello, World (Edited)\n")
+               testEditFileToNewBranch(t, session, "user1", "repo1", "master", "test/slash", "README.md", "Hello, World (Edited)\n")
 
-               resp := testPullCreate(t, session, "user1", "repo1", "master", "This is a pull title")
+               resp := testPullCreate(t, session, "user1", "repo1", "test/slash", "This is a pull title")
 
                elem := strings.Split(test.RedirectURL(resp), "/")
                assert.EqualValues(t, "pulls", elem[3])
diff --git a/integrations/sqlite.ini b/integrations/sqlite.ini
index b188406ee..5bb6770f3 100644
--- a/integrations/sqlite.ini
+++ b/integrations/sqlite.ini
@@ -68,7 +68,7 @@ LEVEL                = Info
 COLORIZE             = true
 
 [log.file]
-LEVEL                = Debug
+LEVEL                = Trace
 
 [security]
 INSTALL_LOCK   = true

And got logs like

58 2019/08/31 10:40:06 ...ers/routes/routes.go:99:func1() [I] Started GET /api/internal/branch/117/test/slash for 127.0.0.1
 59 2019/08/31 10:40:06 ...s/context/context.go:316:func1() [D] Session ID: 6204df09e65417fc
 60 2019/08/31 10:40:06 ...s/context/context.go:317:func1() [D] CSRF Token: AQQIFhTEYFRTo_3SDhMvH3GQFCg6MTU2NzIxOTIwNjE2MjE5ODAwMA
 61 2019/08/31 10:40:06 routers/repo/http.go:97:HTTP() [E] GetUserByName: user does not exist [uid: 0, name: api, keyid: 0]
 62 2019/08/31 10:40:06 ...s/context/context.go:138:HTML() [D] Template: status/404
 63 2019/08/31 10:40:06 ...ers/routes/routes.go:105:func1() [I] Completed GET /api/internal/branch/117/test/slash 404 Not Found in 3.246726ms
 64 2019/08/31 10:40:06 ...s/context/context.go:138:HTML() [D] Template: repo/editor/edit
 65 2019/08/31 10:40:06 ...ers/routes/routes.go:105:func1() [I] Completed POST user1/repo1/_edit/master/README.md 302 Found in 374.046699ms
 66 2019/08/31 10:40:06 ...ers/routes/routes.go:99:func1() [I] Started GET user1/repo1/raw/branch/test/slash/README.md for•
 67 2019/08/31 10:40:06 ...s/context/context.go:316:func1() [D] Session ID: 234d52ab12a1f0c7
 68 2019/08/31 10:40:06 ...s/context/context.go:317:func1() [D] CSRF Token: PLkBzv4V2dpuPtBJf1i1JDWZYr86MTU2NzIxOTIwNTY0ODMyODAwMA
 69 2019/08/31 10:40:06 ...ules/context/repo.go:638:func1() [E] RepoRef invalid repo: branch or tag not exist:•
 70 2019/08/31 10:40:06 ...s/context/context.go:138:HTML() [D] Template: status/404
 71 2019/08/31 10:40:06 ...ers/routes/routes.go:105:func1() [I] Completed GET user1/repo1/raw/branch/test/slash/README.md 404 Not Found in 6.61151ms
 72 2019/08/31 10:40:06 ...ers/routes/routes.go:99:func1() [I] Started GET user1/repo1 for•
 73 2019/08/31 10:40:06 ...s/context/context.go:316:func1() [D] Session ID: 234d52ab12a1f0c7
 74 2019/08/31 10:40:06 ...s/context/context.go:317:func1() [D] CSRF Token: PLkBzv4V2dpuPtBJf1i1JDWZYr86MTU2NzIxOTIwNTY0ODMyODAwMA
 75 2019/08/31 10:40:06 ...s/charset/charset.go:121:DetectEncoding() [D] Detected encoding: utf-8 (fast)
 76 2019/08/31 10:40:06 ...s/context/context.go:138:HTML() [D] Template: repo/home
 77 2019/08/31 10:40:06 ...ers/routes/routes.go:105:func1() [I] Completed GET user1/repo1 200 OK in 9.713332ms
 78 2019/08/31 10:40:06 ...ers/routes/routes.go:99:func1() [I] Started GET /user2/repo1/compare/master...user1:test/slash for•
 79 2019/08/31 10:40:06 ...s/context/context.go:316:func1() [D] Session ID: 234d52ab12a1f0c7
 80 2019/08/31 10:40:06 ...s/context/context.go:317:func1() [D] CSRF Token: PLkBzv4V2dpuPtBJf1i1JDWZYr86MTU2NzIxOTIwNTY0ODMyODAwMA
 81 2019/08/31 10:40:06 ...s/context/context.go:138:HTML() [D] Template: status/404
 82 2019/08/31 10:40:06 ...ers/routes/routes.go:105:func1() [I] Completed GET /user2/repo1/compare/master...user1:test/slash 404 Not Found in 24.315731ms
 83 2019/08/31 10:40:06 ...ers/routes/routes.go:99:func1() [I] Started POST  for•
 84 2019/08/31 10:40:06 ...s/context/context.go:316:func1() [D] Session ID: 234d52ab12a1f0c7
 85 2019/08/31 10:40:06 ...s/context/context.go:317:func1() [D] CSRF Token: PLkBzv4V2dpuPtBJf1i1JDWZYr86MTU2NzIxOTIwNTY0ODMyODAwMA
 86 2019/08/31 10:40:06 ...s/context/context.go:138:HTML() [D] Template: status/404
 87 2019/08/31 10:40:06 ...ers/routes/routes.go:105:func1() [I] Completed POST  404 Not Found in 2.825537ms                                                                 

I am afraid that the endpoints like /api/internal/branch/117/test/slash could be a problem.

@hanhpv
Copy link

hanhpv commented Sep 1, 2019

Got the same error here:
2019/09/01 06:57:23 routers/repo/pull.go:629:MergePullRequest() [E] Merge: getDiffTree: git diff-tree [/var/lib/gitea/data/tmp/local-repo/merge-93759695.git base:master head:head_repo/test-gitea]: fatal: ambiguous argument 'head_repo/test-gitea': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]'

@hanhpv
Copy link

hanhpv commented Sep 3, 2019

any got this error? The branch does exist (because I can create the PR). However when I try to merge the PR, it says ambiguous argument 'head_repo/test-gitea': unknown revision or path not in the working tree

@typeless
Copy link
Contributor

typeless commented Sep 3, 2019

Please check if #8066 fixes what you encountered. @hanhpv @rmbleeker

@rmbleeker
Copy link
Author

LGTM

@hanhpv
Copy link

hanhpv commented Sep 8, 2019

Hi, with upgrade to 1.9.3, the error 'ambiguous argument' is gone. However, I can't still merge the PR. New error message:
2019/09/08 14:58:19 routers/repo/pull.go:629:MergePullRequest() [E] Merge: getDiffTree: git diff-tree [/var/lib/gitea/data/tmp/local-repo/merge-403559991.git base:master head:head_repo/frontend-starter]: fatal: bad revision 'head_repo/frontend-starter'
any suggestion please?

@typeless
Copy link
Contributor

typeless commented Sep 9, 2019

@hanhpv
Which operating system are you using? Can you create an issue?

@rmbleeker
Copy link
Author

@typeless I'm getting the exact same error after an update to 1.9.3, albeit with different paths of course. For system information see the first comment

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'

@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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants