-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
[Proposal] add api access to git notes #15373
Comments
// swagger:operation POST /repos/{owner}/{repo}/git/notes/{sha} repository repoCreateNote
// swagger:operation GET /repos/{owner}/{repo}/git/notes/{sha} repository repoGetNote
// swagger:operation PATCH /repos/{owner}/{repo}/git/notes/{sha} repository repoUpdateNote
// swagger:operation DELETE /repos/{owner}/{repo}/git/notes/{sha} repository repoDeleteNote
This is minimal version, I don't see a need to include anything else (like merging notes). |
Also, do you need a list endpoint? |
That’s good news. I believe for our use case the best would be to have the git-notes info available when retrieving the commits from a repo, for instance, through: /repos/{owner}/{repo}/commits If there is a performance concern over the general use case, we would also be fine with an additional query parameter that could specify whether to retrieve this data or not. |
Is this issue still open? I'd like to contribute to gitea and this seems like a good first issue. |
yup it's still open. |
Thanks for confirming @zeripath. Any tips on getting started with this issue? |
1.I would say add func to module/git to be able to interact with notes If you need help etc ... feel free to chat with us on discord |
Thanks @zeripath! This should be enough to get me started. |
pardon me for asking if this is obvious, but where in the web ui are git notes shown? as per OP:
for referrence, I am running |
thanks for the response @eveslage |
git notes are not pushed to a remote along with normal commits. Please check out this link for more information. |
git notes are not pushed to a remote along with normal commits.
Please check out this [link](https://stackoverflow.com/questions/18268986/git-how-to-push-messages-added-by-git-notes-to-the-central-git-server) for more information.
Oh, thanks a bunch, you saved my day with that link.
|
alright, so I still haven't managed to successfully conclude the thing. log (click me pls)Aug 13 17:30:46 nebula gitea[3105419]: 2021/08/13 17:30:46 Started GET /api/internal/serv/command/3/wanderer/gitea-git-notes-test?mode=2&verb=git-receive-pack for 127.0.0.1:0 Aug 13 17:30:46 nebula gitea[3105419]: 2021/08/13 17:30:46 Completed GET /api/internal/serv/command/3/wanderer/gitea-git-notes-test?mode=2&verb=git-receive-pack 200 OK in 11.35454ms Aug 13 17:30:47 nebula gitea[3105419]: 2021/08/13 17:30:47 Started POST /api/internal/hook/pre-receive/wanderer/gitea-git-notes-test for 127.0.0.1:0 Aug 13 17:30:47 nebula gitea[3105419]: 2021/08/13 17:30:47 ...ters/private/hook.go:470:HookPreReceive() [E] Unexpected ref: refs/notes/commits Aug 13 17:30:47 nebula gitea[3105419]: /opt/gitea/gitea-src/routers/private/hook.go:470 (0x21ad554) Aug 13 17:30:47 nebula gitea[3105419]: HookPreReceive: log.Error("Unexpected ref: %s", refFullName) Aug 13 17:30:47 nebula gitea[3105419]: /opt/gitea/gitea-src/modules/web/route.go:76 (0x203cfbb) Aug 13 17:30:47 nebula gitea[3105419]: Wrap.func1: t(ctx) Aug 13 17:30:47 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:2049 (0x7b86e3) Aug 13 17:30:47 nebula gitea[3105419]: HandlerFunc.ServeHTTP: f(w, r) Aug 13 17:30:47 nebula gitea[3105419]: /opt/gitea/gitea-src/vendor/github.com/go-chi/chi/mux.go:436 (0x16f296a) Aug 13 17:30:47 nebula gitea[3105419]: (*Mux).routeHTTP: h.ServeHTTP(w, r) Aug 13 17:30:47 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:2049 (0x7b86e3) Aug 13 17:30:47 nebula gitea[3105419]: HandlerFunc.ServeHTTP: f(w, r) Aug 13 17:30:47 nebula gitea[3105419]: /opt/gitea/gitea-src/routers/private/internal.go:31 (0x21c03a4) Aug 13 17:30:47 nebula gitea[3105419]: CheckInternalToken.func1: next.ServeHTTP(w, req) Aug 13 17:30:47 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:2049 (0x7b86e3) Aug 13 17:30:47 nebula gitea[3105419]: HandlerFunc.ServeHTTP: f(w, r) Aug 13 17:30:47 nebula gitea[3105419]: /opt/gitea/gitea-src/modules/context/private.go:42 (0x171494f) Aug 13 17:30:47 nebula gitea[3105419]: PrivateContexter.func1.1: next.ServeHTTP(ctx.Resp, ctx.Req) Aug 13 17:30:47 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:2049 (0x7b86e3) Aug 13 17:30:47 nebula gitea[3105419]: HandlerFunc.ServeHTTP: f(w, r) Aug 13 17:30:47 nebula gitea[3105419]: /opt/gitea/gitea-src/vendor/github.com/go-chi/chi/mux.go:70 (0x16f04ca) Aug 13 17:30:47 nebula gitea[3105419]: (*Mux).ServeHTTP: mx.handler.ServeHTTP(w, r) Aug 13 17:30:47 nebula gitea[3105419]: /opt/gitea/gitea-src/vendor/github.com/go-chi/chi/mux.go:311 (0x16f68bb) Aug 13 17:30:47 nebula gitea[3105419]: (*Mux).Mount.func1: handler.ServeHTTP(w, r) Aug 13 17:30:47 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:2049 (0x7b86e3) Aug 13 17:30:47 nebula gitea[3105419]: HandlerFunc.ServeHTTP: f(w, r) Aug 13 17:30:47 nebula gitea[3105419]: /opt/gitea/gitea-src/vendor/github.com/go-chi/chi/mux.go:436 (0x16f296a) Aug 13 17:30:47 nebula gitea[3105419]: (*Mux).routeHTTP: h.ServeHTTP(w, r) Aug 13 17:30:47 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:2049 (0x7b86e3) Aug 13 17:30:47 nebula gitea[3105419]: HandlerFunc.ServeHTTP: f(w, r) Aug 13 17:30:47 nebula gitea[3105419]: /opt/gitea/gitea-src/routers/common/middleware.go:72 (0x20651bd) Aug 13 17:30:47 nebula gitea[3105419]: Middlewares.func2.1: next.ServeHTTP(resp, req) Aug 13 17:30:47 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:2049 (0x7b86e3) Aug 13 17:30:47 nebula gitea[3105419]: HandlerFunc.ServeHTTP: f(w, r) Aug 13 17:30:47 nebula gitea[3105419]: /opt/gitea/gitea-src/routers/common/logger.go:23 (0x20643fb) Aug 13 17:30:47 nebula gitea[3105419]: LoggerHandler.func1.1: next.ServeHTTP(w, req) Aug 13 17:30:47 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:2049 (0x7b86e3) Aug 13 17:30:47 nebula gitea[3105419]: HandlerFunc.ServeHTTP: f(w, r) Aug 13 17:30:47 nebula gitea[3105419]: /opt/gitea/gitea-src/vendor/github.com/go-chi/chi/middleware/strip.go:30 (0x2060fe7) Aug 13 17:30:47 nebula gitea[3105419]: StripSlashes.func1: next.ServeHTTP(w, r) Aug 13 17:30:47 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:2049 (0x7b86e3) Aug 13 17:30:47 nebula gitea[3105419]: HandlerFunc.ServeHTTP: f(w, r) Aug 13 17:30:47 nebula gitea[3105419]: /opt/gitea/gitea-src/vendor/github.com/chi-middleware/proxy/middleware.go:37 (0x205c64e) Aug 13 17:30:47 nebula gitea[3105419]: ForwardedHeaders.func1.1: h.ServeHTTP(w, r) Aug 13 17:30:47 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:2049 (0x7b86e3) Aug 13 17:30:47 nebula gitea[3105419]: HandlerFunc.ServeHTTP: f(w, r) Aug 13 17:30:47 nebula gitea[3105419]: /opt/gitea/gitea-src/routers/common/middleware.go:25 (0x2064cfc) Aug 13 17:30:47 nebula gitea[3105419]: Middlewares.func1.1: next.ServeHTTP(context.NewResponse(resp), req) Aug 13 17:30:47 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:2049 (0x7b86e3) Aug 13 17:30:47 nebula gitea[3105419]: HandlerFunc.ServeHTTP: f(w, r) Aug 13 17:30:47 nebula gitea[3105419]: /opt/gitea/gitea-src/vendor/github.com/go-chi/chi/mux.go:87 (0x16f0250) Aug 13 17:30:47 nebula gitea[3105419]: (*Mux).ServeHTTP: mx.handler.ServeHTTP(w, r) Aug 13 17:30:47 nebula gitea[3105419]: /opt/gitea/gitea-src/modules/web/route.go:318 (0x203c333) Aug 13 17:30:47 nebula gitea[3105419]: (*Route).ServeHTTP: r.R.ServeHTTP(w, req) Aug 13 17:30:47 nebula gitea[3105419]: /opt/gitea/gitea-src/vendor/github.com/gorilla/context/context.go:141 (0x130d5d3) Aug 13 17:30:47 nebula gitea[3105419]: ClearHandler.func1: h.ServeHTTP(w, r) Aug 13 17:30:47 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:2049 (0x7b86e3) Aug 13 17:30:47 nebula gitea[3105419]: HandlerFunc.ServeHTTP: f(w, r) Aug 13 17:30:47 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:2867 (0x7bbca2) Aug 13 17:30:47 nebula gitea[3105419]: serverHandler.ServeHTTP: handler.ServeHTTP(rw, req) Aug 13 17:30:47 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:1932 (0x7b71cc) Aug 13 17:30:47 nebula gitea[3105419]: (*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req) Aug 13 17:30:47 nebula gitea[3105419]: /usr/lib/go/src/runtime/asm_amd64.s:1371 (0x4747c0) Aug 13 17:30:47 nebula gitea[3105419]: goexit: BYTE $0x90 // NOP Aug 13 17:30:47 nebula gitea[3105419]: Aug 13 17:30:47 nebula gitea[3105419]: 2021/08/13 17:30:47 Completed POST /api/internal/hook/pre-receive/wanderer/gitea-git-notes-test 500 Internal Server Error in 50.831694ms Aug 13 17:30:47 nebula gitea[3105419]: 2021/08/13 17:30:47 Started POST /api/internal/ssh/log for 127.0.0.1:0 Aug 13 17:30:47 nebula gitea[3105419]: 2021/08/13 17:30:47 Completed POST /api/internal/ssh/log 200 OK in 226.779µs Aug 13 17:30:47 nebula gitea[3105419]: 2021/08/13 17:30:47 Started POST /api/internal/ssh/3/update/647 for 127.0.0.1:0 Aug 13 17:30:47 nebula gitea[3105419]: 2021/08/13 17:30:47 Completed POST /api/internal/ssh/3/update/647 200 OK in 5.372184ms ... Aug 13 17:35:00 nebula gitea[3105419]: 2021/08/13 17:35:00 Started GET /api/internal/serv/command/3/wanderer/gitea-git-notes-test?mode=2&verb=git-receive-pack for 127.0.0.1:0 Aug 13 17:35:00 nebula gitea[3105419]: 2021/08/13 17:35:00 Completed GET /api/internal/serv/command/3/wanderer/gitea-git-notes-test?mode=2&verb=git-receive-pack 200 OK in 8.900563ms Aug 13 17:35:01 nebula gitea[3105419]: 2021/08/13 17:35:01 Started POST /api/internal/hook/pre-receive/wanderer/gitea-git-notes-test for 127.0.0.1:0 Aug 13 17:35:01 nebula gitea[3105419]: 2021/08/13 17:35:01 ...ters/private/hook.go:470:HookPreReceive() [E] Unexpected ref: refs/notes/commits Aug 13 17:35:01 nebula gitea[3105419]: /opt/gitea/gitea-src/routers/private/hook.go:470 (0x21ad554) Aug 13 17:35:01 nebula gitea[3105419]: HookPreReceive: log.Error("Unexpected ref: %s", refFullName) Aug 13 17:35:01 nebula gitea[3105419]: /opt/gitea/gitea-src/modules/web/route.go:76 (0x203cfbb) Aug 13 17:35:01 nebula gitea[3105419]: Wrap.func1: t(ctx) Aug 13 17:35:01 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:2049 (0x7b86e3) Aug 13 17:35:01 nebula gitea[3105419]: HandlerFunc.ServeHTTP: f(w, r) Aug 13 17:35:01 nebula gitea[3105419]: /opt/gitea/gitea-src/vendor/github.com/go-chi/chi/mux.go:436 (0x16f296a) Aug 13 17:35:01 nebula gitea[3105419]: (*Mux).routeHTTP: h.ServeHTTP(w, r) Aug 13 17:35:01 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:2049 (0x7b86e3) Aug 13 17:35:01 nebula gitea[3105419]: HandlerFunc.ServeHTTP: f(w, r) Aug 13 17:35:01 nebula gitea[3105419]: /opt/gitea/gitea-src/routers/private/internal.go:31 (0x21c03a4) Aug 13 17:35:01 nebula gitea[3105419]: CheckInternalToken.func1: next.ServeHTTP(w, req) Aug 13 17:35:01 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:2049 (0x7b86e3) Aug 13 17:35:01 nebula gitea[3105419]: HandlerFunc.ServeHTTP: f(w, r) Aug 13 17:35:01 nebula gitea[3105419]: /opt/gitea/gitea-src/modules/context/private.go:42 (0x171494f) Aug 13 17:35:01 nebula gitea[3105419]: PrivateContexter.func1.1: next.ServeHTTP(ctx.Resp, ctx.Req) Aug 13 17:35:01 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:2049 (0x7b86e3) Aug 13 17:35:01 nebula gitea[3105419]: HandlerFunc.ServeHTTP: f(w, r) Aug 13 17:35:01 nebula gitea[3105419]: /opt/gitea/gitea-src/vendor/github.com/go-chi/chi/mux.go:70 (0x16f04ca) Aug 13 17:35:01 nebula gitea[3105419]: (*Mux).ServeHTTP: mx.handler.ServeHTTP(w, r) Aug 13 17:35:01 nebula gitea[3105419]: /opt/gitea/gitea-src/vendor/github.com/go-chi/chi/mux.go:311 (0x16f68bb) Aug 13 17:35:01 nebula gitea[3105419]: (*Mux).Mount.func1: handler.ServeHTTP(w, r) Aug 13 17:35:01 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:2049 (0x7b86e3) Aug 13 17:35:01 nebula gitea[3105419]: HandlerFunc.ServeHTTP: f(w, r) Aug 13 17:35:01 nebula gitea[3105419]: /opt/gitea/gitea-src/vendor/github.com/go-chi/chi/mux.go:436 (0x16f296a) Aug 13 17:35:01 nebula gitea[3105419]: (*Mux).routeHTTP: h.ServeHTTP(w, r) Aug 13 17:35:01 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:2049 (0x7b86e3) Aug 13 17:35:01 nebula gitea[3105419]: HandlerFunc.ServeHTTP: f(w, r) Aug 13 17:35:01 nebula gitea[3105419]: /opt/gitea/gitea-src/routers/common/middleware.go:72 (0x20651bd) Aug 13 17:35:01 nebula gitea[3105419]: Middlewares.func2.1: next.ServeHTTP(resp, req) Aug 13 17:35:01 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:2049 (0x7b86e3) Aug 13 17:35:01 nebula gitea[3105419]: HandlerFunc.ServeHTTP: f(w, r) Aug 13 17:35:01 nebula gitea[3105419]: /opt/gitea/gitea-src/routers/common/logger.go:23 (0x20643fb) Aug 13 17:35:01 nebula gitea[3105419]: LoggerHandler.func1.1: next.ServeHTTP(w, req) Aug 13 17:35:01 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:2049 (0x7b86e3) Aug 13 17:35:01 nebula gitea[3105419]: HandlerFunc.ServeHTTP: f(w, r) Aug 13 17:35:01 nebula gitea[3105419]: /opt/gitea/gitea-src/vendor/github.com/go-chi/chi/middleware/strip.go:30 (0x2060fe7) Aug 13 17:35:01 nebula gitea[3105419]: StripSlashes.func1: next.ServeHTTP(w, r) Aug 13 17:35:01 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:2049 (0x7b86e3) Aug 13 17:35:01 nebula gitea[3105419]: HandlerFunc.ServeHTTP: f(w, r) Aug 13 17:35:01 nebula gitea[3105419]: /opt/gitea/gitea-src/vendor/github.com/chi-middleware/proxy/middleware.go:37 (0x205c64e) Aug 13 17:35:01 nebula gitea[3105419]: ForwardedHeaders.func1.1: h.ServeHTTP(w, r) Aug 13 17:35:01 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:2049 (0x7b86e3) Aug 13 17:35:01 nebula gitea[3105419]: HandlerFunc.ServeHTTP: f(w, r) Aug 13 17:35:01 nebula gitea[3105419]: /opt/gitea/gitea-src/routers/common/middleware.go:25 (0x2064cfc) Aug 13 17:35:01 nebula gitea[3105419]: Middlewares.func1.1: next.ServeHTTP(context.NewResponse(resp), req) Aug 13 17:35:01 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:2049 (0x7b86e3) Aug 13 17:35:01 nebula gitea[3105419]: HandlerFunc.ServeHTTP: f(w, r) Aug 13 17:35:01 nebula gitea[3105419]: /opt/gitea/gitea-src/vendor/github.com/go-chi/chi/mux.go:87 (0x16f0250) Aug 13 17:35:01 nebula gitea[3105419]: (*Mux).ServeHTTP: mx.handler.ServeHTTP(w, r) Aug 13 17:35:01 nebula gitea[3105419]: /opt/gitea/gitea-src/modules/web/route.go:318 (0x203c333) Aug 13 17:35:01 nebula gitea[3105419]: (*Route).ServeHTTP: r.R.ServeHTTP(w, req) Aug 13 17:35:01 nebula gitea[3105419]: /opt/gitea/gitea-src/vendor/github.com/gorilla/context/context.go:141 (0x130d5d3) Aug 13 17:35:01 nebula gitea[3105419]: ClearHandler.func1: h.ServeHTTP(w, r) Aug 13 17:35:01 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:2049 (0x7b86e3) Aug 13 17:35:01 nebula gitea[3105419]: HandlerFunc.ServeHTTP: f(w, r) Aug 13 17:35:01 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:2867 (0x7bbca2) Aug 13 17:35:01 nebula gitea[3105419]: serverHandler.ServeHTTP: handler.ServeHTTP(rw, req) Aug 13 17:35:01 nebula gitea[3105419]: /usr/lib/go/src/net/http/server.go:1932 (0x7b71cc) Aug 13 17:35:01 nebula gitea[3105419]: (*conn).serve: serverHandler{c.server}.ServeHTTP(w, w.req) Aug 13 17:35:01 nebula gitea[3105419]: /usr/lib/go/src/runtime/asm_amd64.s:1371 (0x4747c0) Aug 13 17:35:01 nebula gitea[3105419]: goexit: BYTE $0x90 // NOP Aug 13 17:35:01 nebula gitea[3105419]: Aug 13 17:35:01 nebula gitea[3105419]: 2021/08/13 17:35:01 Completed POST /api/internal/hook/pre-receive/wanderer/gitea-git-notes-test 500 Internal Server Error in 121.080434ms Aug 13 17:35:01 nebula gitea[3105419]: 2021/08/13 17:35:01 Started POST /api/internal/ssh/log for 127.0.0.1:0 Aug 13 17:35:01 nebula gitea[3105419]: 2021/08/13 17:35:01 Completed POST /api/internal/ssh/log 200 OK in 161.392µs Aug 13 17:35:01 nebula gitea[3105419]: 2021/08/13 17:35:01 Started POST /api/internal/ssh/3/update/647 for 127.0.0.1:0 Aug 13 17:35:01 nebula gitea[3105419]: 2021/08/13 17:35:01 Completed POST /api/internal/ssh/3/update/647 200 OK in 26.496472ms client-side, this is what I get
am I doing something wrong or is this for another issue? |
This is not normal. Check your logs. |
I have, they are linked in my previous post. |
Which post? By logs I mean the logs on Gitea. |
this thing here a couple of messages back under "logs" - contains this:
|
Please don't debug in a closed issue. If Gitea is broken please open a new issue, otherwise please join chat. |
Looks like this is a real bug and regression from #15629 @wULLSnpAXbWZGYDYyhWTKKspEQoaYxXyhoisqHf can you open a new issue please |
Your api is quite powerful to access al kinds of information in a git repository. But there is no way to access git-notes.
https://git-scm.com/docs/git-notes
we use git-notes to annotate commits without changing the commit itself. git log shows them along with the commit messages and gitea shows them in the web ui. But the api access is missing.
it would be nice to have access to git-notes though the api.
The text was updated successfully, but these errors were encountered: