@@ -750,7 +750,6 @@ func (s *Git) ScanCommits(ctx context.Context, repo *git.Repository, path string
750750
751751 email := commit .Author
752752 when := commit .Date .UTC ().Format ("2006-01-02 15:04:05 -0700" )
753-
754753 if fullHash != lastCommitHash {
755754 depth ++
756755 lastCommitHash = fullHash
@@ -901,6 +900,14 @@ func (s *Git) gitChunk(ctx context.Context, diff *gitparse.Diff, fileName, email
901900 defer func () { _ = reader .Close () }()
902901
903902 originalChunk := bufio .NewScanner (reader )
903+ // Default bufio max token size (64 KB) is too small for files with long lines
904+ // (e.g. minified JS, base64 blobs). Raise the cap to 10 MB so those lines
905+ // are still scanned; the oversize-line path below will chunk them correctly.
906+ // The initial buffer starts at 4 KB (same as bufio's default) and grows only
907+ // when a line actually exceeds the current size, keeping allocations cheap for
908+ // the common case of small diffs.
909+ const maxScanTokenSize = 10 * 1024 * 1024
910+ originalChunk .Buffer (make ([]byte , 4096 ), maxScanTokenSize )
904911 newChunkBuffer := bytes.Buffer {}
905912 lastOffset := 0
906913 for offset := 0 ; originalChunk .Scan (); offset ++ {
@@ -967,6 +974,9 @@ func (s *Git) gitChunk(ctx context.Context, diff *gitparse.Diff, fileName, email
967974 ctx .Logger ().Error (err , "error writing to chunk buffer" , "filename" , fileName , "commit" , hash , "file" , diff .PathB )
968975 }
969976 }
977+ if err := originalChunk .Err (); err != nil {
978+ ctx .Logger ().Error (err , "error scanning chunk" , "filename" , fileName , "commit" , hash , "file" , diff .PathB )
979+ }
970980 // Send anything still in the new chunk buffer
971981 if newChunkBuffer .Len () > 0 {
972982 metadata := s .sourceMetadataFunc (SourceMetadataInfo {
0 commit comments