diff options
author | Antonio Jesus Navarro Perez <antnavper@gmail.com> | 2017-06-19 16:38:16 +0200 |
---|---|---|
committer | Antonio Jesus Navarro Perez <antnavper@gmail.com> | 2017-06-19 16:38:16 +0200 |
commit | 76281a5d1d715cd25f439da87bea1419648d78e9 (patch) | |
tree | 64fb653eca51989d13dc55a49c154c30d7640aec /storage/filesystem/internal | |
parent | ad7432333d5859352ca67864815c4e5037fcd4eb (diff) | |
download | go-git-76281a5d1d715cd25f439da87bea1419648d78e9.tar.gz |
internal/dotgit: rewrite code to avoid stackoverflow errors
Diffstat (limited to 'storage/filesystem/internal')
-rw-r--r-- | storage/filesystem/internal/dotgit/writers.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/storage/filesystem/internal/dotgit/writers.go b/storage/filesystem/internal/dotgit/writers.go index 2407c58..e0a41a8 100644 --- a/storage/filesystem/internal/dotgit/writers.go +++ b/storage/filesystem/internal/dotgit/writers.go @@ -190,14 +190,14 @@ func (s *syncedReader) Write(p []byte) (n int, err error) { func (s *syncedReader) Read(p []byte) (n int, err error) { defer func() { atomic.AddUint64(&s.read, uint64(n)) }() - s.sleep() - n, err = s.r.Read(p) - if err == io.EOF && !s.isDone() { - if n == 0 { - return s.Read(p) + for { + s.sleep() + n, err = s.r.Read(p) + if err == io.EOF && !s.isDone() && n == 0 { + continue } - return n, nil + break } return |