(ctx *gin.Context)
| 117 | } |
| 118 | |
| 119 | func (h *GitHTTPHandler) GitReceivePack(ctx *gin.Context) { |
| 120 | gitProtocol := ctx.GetHeader("Git-Protocol") |
| 121 | req := types.GitUploadPackReq{ |
| 122 | Namespace: ctx.GetString("namespace"), |
| 123 | Name: ctx.GetString("name"), |
| 124 | RepoType: types.RepositoryType(ctx.GetString("repo_type")), |
| 125 | GitProtocol: gitProtocol, |
| 126 | Request: ctx.Request, |
| 127 | Writer: ctx.Writer, |
| 128 | CurrentUser: httpbase.GetCurrentUser(ctx), |
| 129 | } |
| 130 | action := getService(ctx.Request) |
| 131 | |
| 132 | ctx.Header("Content-Type", fmt.Sprintf("application/x-%s-result", action)) |
| 133 | ctx.Header("Cache-Control", "no-cache") |
| 134 | |
| 135 | err := h.c.GitReceivePack(ctx, req) |
| 136 | if err != nil { |
| 137 | if err == component.ErrUnauthorized { |
| 138 | ctx.Header("WWW-Authenticate", "Basic realm=opencsg-git") |
| 139 | ctx.PureJSON(http.StatusUnauthorized, nil) |
| 140 | return |
| 141 | } |
| 142 | |
| 143 | if err == component.ErrForbidden { |
| 144 | ctx.PureJSON(http.StatusForbidden, gin.H{ |
| 145 | "error": "You do not have permission to access this repository.", |
| 146 | }) |
| 147 | return |
| 148 | } |
| 149 | httpbase.ServerError(ctx, err) |
| 150 | return |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | func (h *GitHTTPHandler) LfsBatch(ctx *gin.Context) { |
| 155 | var batchRequest types.BatchRequest |
nothing calls this directly
no test coverage detected