Closed RelicOfTesla closed 5 years ago
It would be helpful to get the log in cases like this, however it appears simple to replicate.
When trying the /issues/new endpoint I get:
2019/10/16 10:20:54 ...les/context/panic.go:35:1() [E] PANIC:: runtime error: invalid memory address or nil pointer dereference
/usr/lib/go-1.13/src/runtime/panic.go:199 (0x452b4b)
panicmem: panic(memoryError)
/usr/lib/go-1.13/src/runtime/signal_unix.go:394 (0x452988)
sigpanic: panicmem()
/home/andrew/go/src/code.gitea.io/gitea/modules/git/repo_commit.go:22 (0x954e85)
(*Repository).GetRefCommitID: ref, err := repo.gogitRepo.Reference(plumbing.ReferenceName(name), true)
/home/andrew/go/src/code.gitea.io/gitea/modules/git/repo_commit.go:39 (0x9565c8)
(*Repository).GetBranchCommitID: return repo.GetRefCommitID(BranchPrefix + name)
/home/andrew/go/src/code.gitea.io/gitea/modules/git/repo_commit.go:149 (0x956571)
(*Repository).GetBranchCommit: commitID, err := repo.GetBranchCommitID(name)
/home/andrew/go/src/code.gitea.io/gitea/routers/repo/issue.go:385 (0x125c0d3)
getFileContentFromDefaultBranch: ctx.Repo.Commit, err = ctx.Repo.GitRepo.GetBranchCommit(ctx.Repo.Repository.DefaultBranch)
/home/andrew/go/src/code.gitea.io/gitea/routers/repo/issue.go:412 (0x125c1cb)
setTemplateIfExists: content, found := getFileContentFromDefaultBranch(ctx, filename)
/home/andrew/go/src/code.gitea.io/gitea/routers/repo/issue.go:442 (0x125c717)
NewIssue: setTemplateIfExists(ctx, issueTemplateKey, IssueTemplateCandidates)
/usr/lib/go-1.13/src/reflect/value.go:460 (0x49dea5)
...
And on /settings/hook/git:
2019/10/16 10:22:31 ...les/context/panic.go:35:1() [E] PANIC:: runtime error: invalid memory address or nil pointer dereference
/usr/lib/go-1.13/src/runtime/panic.go:199 (0x452b4b)
panicmem: panic(memoryError)
/usr/lib/go-1.13/src/runtime/signal_unix.go:394 (0x452988)
sigpanic: panicmem()
/home/andrew/go/src/code.gitea.io/gitea/routers/repo/setting.go:685 (0x1297406)
GitHooks: hooks, err := ctx.Repo.GitRepo.Hooks()
/home/andrew/go/src/code.gitea.io/gitea/routers/repo/setting.go:685 (0x12973fa)
GitHooks: hooks, err := ctx.Repo.GitRepo.Hooks()
/usr/lib/go-1.13/src/reflect/value.go:460 (0x49dea5)
Value.call: call(frametype, fn, args, uint32(frametype.size), uint32(retOffset))
/usr/lib/go-1.13/src/reflect/value.go:321 (0x49d663)
Value.Call: return v.call("Call", in)
/home/andrew/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/inject/inject.go:177 (0x9b1d79)
(*injector).callInvoke: return reflect.ValueOf(f).Call(in), nil
/home/andrew/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/inject/inject.go:137 (0x9b1729)
(*injector).Invoke: return inj.callInvoke(f, t, t.NumIn())
/home/andrew/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/context.go:121 (0x9e18c8)
(*Context).run: vals, err := c.Invoke(c.handler())
/home/andrew/go/src/code.gitea.io/gitea/vendor/gitea.com/macaron/macaron/context.go:112 (0x10db6d1)
(*Context).Next: c.run()
So the problem is that either ctx.Repo.GitRepo
is nil or ctx.Repo
is nil.
Implies that in an empty repo - ctx.Repo.GitRepo
will be nil
Simplest Solution:
[x]
):Description
step1. New/Create Repository step2. http://xxxxx:3000/xxxx/xxxx/issues/new or /xxxx/xxxx/settings/hooks/git response 500 error
...
Screenshots