From ab80c06a26578da6141954f30e2a6e71c32d50b4 Mon Sep 17 00:00:00 2001 From: bill-rich Date: Mon, 21 Nov 2022 16:29:22 -0800 Subject: [PATCH] Add newlines when file is split --- pkg/sources/git/git.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/sources/git/git.go b/pkg/sources/git/git.go index 2096a2db4885..522405b2800e 100644 --- a/pkg/sources/git/git.go +++ b/pkg/sources/git/git.go @@ -408,7 +408,9 @@ func (s *Git) gitChunk(ctx context.Context, diff gitparse.Diff, fileName, email, newChunkBuffer := bytes.Buffer{} lastOffset := 0 for offset := 0; originalChunk.Scan(); offset++ { - line := originalChunk.Bytes() + line := make([]byte, len(originalChunk.Bytes())+1) + copy(line, originalChunk.Bytes()) + line[len(line)-1] = byte('\n') if len(line) > sources.ChunkSize || len(line)+newChunkBuffer.Len() > sources.ChunkSize { // Add oversize chunk info if newChunkBuffer.Len() > 0 {