aboutsummaryrefslogtreecommitdiffstats
path: root/storage
diff options
context:
space:
mode:
authorAntonio Jesus Navarro Perez <antnavper@gmail.com>2017-06-19 16:38:16 +0200
committerAntonio Jesus Navarro Perez <antnavper@gmail.com>2017-06-19 16:38:16 +0200
commit76281a5d1d715cd25f439da87bea1419648d78e9 (patch)
tree64fb653eca51989d13dc55a49c154c30d7640aec /storage
parentad7432333d5859352ca67864815c4e5037fcd4eb (diff)
downloadgo-git-76281a5d1d715cd25f439da87bea1419648d78e9.tar.gz
internal/dotgit: rewrite code to avoid stackoverflow errors
Diffstat (limited to 'storage')
-rw-r--r--storage/filesystem/internal/dotgit/writers.go12
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