all repos

mugit @ 3b5e3bf

馃惍 git server that your cow will love
2 files changed, 8 insertions(+), 3 deletions(-)
http: fix flushing and error responses for git requests
Author: Oleksandr Smirnov olexsmir@gmail.com
Committed at: 2026-04-03 15:44:06 +0300
Authored at: 2026-04-03 12:48:05 +0300
Change ID: ltlpqnvorwmkrpmypurzstxvmxqyookw
Parent: 326692c
M internal/handlers/git.go
路路路
        27
        27
         

      
        28
        28
         		w.WriteHeader(http.StatusOK)

      
        29
        29
         		if err := repo.InfoRefs(r.Context(), gitProtocol, w); err != nil {

      
        30
        
        -			h.gitError(w, http.StatusInternalServerError, err.Error())

      
        
        30
        +			git.PackError(w, err.Error())

      
        31
        31
         			slog.Error("git: info/refs", "err", err)

      
        32
        32
         			return

      
        33
        33
         		}

      路路路
        74
        74
         

      
        75
        75
         	w.WriteHeader(http.StatusOK)

      
        76
        76
         	if err := repo.UploadPack(r.Context(), true, gitProtocol, bodyReader, newFlushWriter(w)); err != nil {

      
        77
        
        -		h.gitError(w, http.StatusInternalServerError, err.Error())

      
        
        77
        +		git.PackError(w, err.Error())

      
        78
        78
         		slog.Error("git: upload-pack", "err", err)

      
        79
        79
         		return

      
        80
        
        -

      
        81
        80
         	}

      
        82
        81
         }

      
        83
        82
         

      
M internal/handlers/util.go
路路路
        76
        76
         	rw.ResponseWriter.WriteHeader(code)

      
        77
        77
         	rw.wroteHeader = true

      
        78
        78
         }

      
        
        79
        +

      
        
        80
        +func (rw *responseWriter) Flush() {

      
        
        81
        +	if f, ok := rw.ResponseWriter.(http.Flusher); ok {

      
        
        82
        +		f.Flush()

      
        
        83
        +	}

      
        
        84
        +}