MCPcopy Create free account
hub / github.com/OpenCSGs/csghub-server / GitUploadPack

Method GitUploadPack

api/handler/git_http.go:96–117  ·  view source on GitHub ↗

func (h *GitHTTPHandler) HEAD(ctx *gin.Context) { httpbase.OK(ctx, nil) }

(ctx *gin.Context)

Source from the content-addressed store, hash-verified

94// }
95
96func (h *GitHTTPHandler) GitUploadPack(ctx *gin.Context) {
97 gitProtocol := ctx.GetHeader("Git-Protocol")
98 req := types.GitUploadPackReq{
99 Namespace: ctx.GetString("namespace"),
100 Name: ctx.GetString("name"),
101 RepoType: types.RepositoryType(ctx.GetString("repo_type")),
102 GitProtocol: gitProtocol,
103 Request: ctx.Request,
104 Writer: ctx.Writer,
105 CurrentUser: httpbase.GetCurrentUser(ctx),
106 }
107 action := getService(ctx.Request)
108
109 ctx.Header("Content-Type", fmt.Sprintf("application/x-%s-result", action))
110 ctx.Header("Cache-Control", "no-cache")
111
112 err := h.c.GitUploadPack(ctx, req)
113 if err != nil {
114 httpbase.ServerError(ctx, err)
115 return
116 }
117}
118
119func (h *GitHTTPHandler) GitReceivePack(ctx *gin.Context) {
120 gitProtocol := ctx.GetHeader("Git-Protocol")

Callers

nothing calls this directly

Calls 4

RepositoryTypeTypeAlias · 0.92
GetCurrentUserFunction · 0.92
ServerErrorFunction · 0.92
getServiceFunction · 0.85

Tested by

no test coverage detected