MCPcopy Create free account
hub / github.com/asim/git-http-backend / sendFile

Function sendFile

server/server.go:274–288  ·  view source on GitHub ↗

Logic helping functions

(content_type string, hr HandlerReq)

Source from the content-addressed store, hash-verified

272// Logic helping functions
273
274func sendFile(content_type string, hr HandlerReq) {
275 w, r := hr.w, hr.r
276 req_file := path.Join(hr.Dir, hr.File)
277
278 f, err := os.Stat(req_file)
279 if os.IsNotExist(err) {
280 renderNotFound(w)
281 return
282 }
283
284 w.Header().Set("Content-Type", content_type)
285 w.Header().Set("Content-Length", fmt.Sprintf("%d", f.Size()))
286 w.Header().Set("Last-Modified", f.ModTime().Format(http.TimeFormat))
287 http.ServeFile(w, r, req_file)
288}
289
290func getGitDir(file_path string) (string, error) {
291 root := DefaultConfig.ProjectRoot

Callers 6

getInfoRefsFunction · 0.85
getInfoPacksFunction · 0.85
getLooseObjectFunction · 0.85
getPackFileFunction · 0.85
getIdxFileFunction · 0.85
getTextFileFunction · 0.85

Calls 1

renderNotFoundFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…