We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi,
I've been experimenting with git notes and noticed that notes on tags are not properly handled. See this link: https://try.gitea.io/api/v1/repos/wiktor/dks/git/notes/v1
git notes
It triggers the following panic:
2023/03/07 11:58:58 ...common/middleware.go:71:1() [E] [640718f2] PANIC: runtime error: invalid memory address or nil pointer dereference /usr/lib/go/src/runtime/panic.go:260 (0x45883c) panicmem: panic(memoryError) /usr/lib/go/src/runtime/signal_unix.go:837 (0x45880c) sigpanic: panicmem() /home/wiktor/src/open-source/gitea/modules/git/tree_entry_nogogit.go:93 (0x1019cda) (*TreeEntry).Blob: ID: te.ID, /home/wiktor/src/open-source/gitea/modules/git/notes_nogogit.go:56 (0x1019a12) GetNote: blob := entry.Blob() /home/wiktor/src/open-source/gitea/routers/api/v1/repo/notes.go:62 (0x220f0a4) getNote: if err := git.GetNote(ctx, ctx.Repo.GitRepo, identifier, ¬e); err != nil {
I think the code assumes notes are only for commits and tries to get the Tree but Tags don't have it.
1.20.0+dev-101-g84a299310
Yes
No response
Locally and via try.gitea.io
None
The text was updated successfully, but these errors were encountered:
Fix panic when getting notes by ref (#23372)
15a1c2d
Fix #23357 . Now the `/repos/{owner}/{repo}/git/notes/{sha}` API supports getting notes by a ref or sha (https://try.gitea.io/api/swagger#/repository/repoGetNote). But the `GetNote` func can only accept commit ID. https://github.com/go-gitea/gitea/blob/a12f5757372f751d25f9e5ca1f168f6920ded894/modules/git/notes_nogogit.go#L18 So we need to convert the query parameter to commit ID before calling `GetNote`.
Fix panic when getting notes by ref (go-gitea#23372)
12f277a
Fix go-gitea#23357 . Now the `/repos/{owner}/{repo}/git/notes/{sha}` API supports getting notes by a ref or sha (https://try.gitea.io/api/swagger#/repository/repoGetNote). But the `GetNote` func can only accept commit ID. https://github.com/go-gitea/gitea/blob/a12f5757372f751d25f9e5ca1f168f6920ded894/modules/git/notes_nogogit.go#L18 So we need to convert the query parameter to commit ID before calling `GetNote`.
Fix panic when getting notes by ref (#23372) (#23377)
54c674c
Backport #23372 Fix #23357 . Now the `/repos/{owner}/{repo}/git/notes/{sha}` API supports getting notes by a ref or sha (https://try.gitea.io/api/swagger#/repository/repoGetNote). But the `GetNote` func can only accept commit ID. https://github.com/go-gitea/gitea/blob/a12f5757372f751d25f9e5ca1f168f6920ded894/modules/git/notes_nogogit.go#L18 So we need to convert the query parameter to commit ID before calling `GetNote`. Co-authored-by: Zettat123 <zettat123@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Zettat123
Successfully merging a pull request may close this issue.
Description
Hi,
I've been experimenting with
git notes
and noticed that notes on tags are not properly handled. See this link: https://try.gitea.io/api/v1/repos/wiktor/dks/git/notes/v1It triggers the following panic:
I think the code assumes notes are only for commits and tries to get the Tree but Tags don't have it.
Gitea Version
1.20.0+dev-101-g84a299310
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
No response
Screenshots
No response
Git Version
No response
Operating System
No response
How are you running Gitea?
Locally and via try.gitea.io
Database
None
The text was updated successfully, but these errors were encountered: