aboutsummaryrefslogtreecommitdiff
path: root/git/service/write_flusher.go
diff options
context:
space:
mode:
authorAnirudh Oppiliappan <x@icyphox.sh>2024-07-13 20:06:37 +0300
committerAnirudh Oppiliappan <x@icyphox.sh>2024-07-13 20:08:54 +0300
commitfba146ac6867b13c40802c4d7a21a8a32571473c (patch)
tree90fe936d2ed43b97c531e08f5189fccf3ef625cd /git/service/write_flusher.go
parentdeps: bump golang.org/x/net from 0.22.0 to 0.23.0 (#40) (diff)
downloadlegitrx-fba146ac6867b13c40802c4d7a21a8a32571473c.tar.gz
legitrx-fba146ac6867b13c40802c4d7a21a8a32571473c.tar.zst
legitrx-fba146ac6867b13c40802c4d7a21a8a32571473c.zip
git: use system's git upload-pack
This is an intermediate workaround for https://github.com/go-git/go-git/issues/1062. This should also fix #33.
Diffstat (limited to '')
-rw-r--r--git/service/write_flusher.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/git/service/write_flusher.go b/git/service/write_flusher.go
new file mode 100644
index 0000000..f25a5ae
--- /dev/null
+++ b/git/service/write_flusher.go
@@ -0,0 +1,25 @@
+package service
+
+import (
+ "io"
+ "net/http"
+)
+
+func newWriteFlusher(w http.ResponseWriter) io.Writer {
+ return writeFlusher{w.(interface {
+ io.Writer
+ http.Flusher
+ })}
+}
+
+type writeFlusher struct {
+ wf interface {
+ io.Writer
+ http.Flusher
+ }
+}
+
+func (w writeFlusher) Write(p []byte) (int, error) {
+ defer w.wf.Flush()
+ return w.wf.Write(p)
+}