summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Haller <stefan@haller-berlin.de>2024-04-27 17:19:08 +0200
committerStefan Haller <stefan@haller-berlin.de>2024-04-27 19:43:50 +0200
commit52e8efc5fe6d87a286982f6327597301c7469b62 (patch)
tree00d6798f45dae45aa358dc22a09421b406c827bd
parentb6abfd504b82e3ab17f96241908d28948b40591a (diff)
Use ScanLinesAndTruncateWhenLongerThanBuffer instead of bufio.ScanLinesfix-loading-commits-with-very-long-subjects
-rw-r--r--pkg/commands/oscommands/cmd_obj_runner.go2
-rw-r--r--pkg/gui/mergeconflicts/find_conflicts.go2
-rw-r--r--pkg/tasks/tasks.go2
3 files changed, 3 insertions, 3 deletions
diff --git a/pkg/commands/oscommands/cmd_obj_runner.go b/pkg/commands/oscommands/cmd_obj_runner.go
index 5f28196e3..16257158e 100644
--- a/pkg/commands/oscommands/cmd_obj_runner.go
+++ b/pkg/commands/oscommands/cmd_obj_runner.go
@@ -161,7 +161,7 @@ func (self *cmdObjRunner) RunAndProcessLines(cmdObj ICmdObj, onLine func(line st
}
scanner := bufio.NewScanner(stdoutPipe)
- scanner.Split(bufio.ScanLines)
+ scanner.Split(utils.ScanLinesAndTruncateWhenLongerThanBuffer(bufio.MaxScanTokenSize))
if err := cmd.Start(); err != nil {
return err
}
diff --git a/pkg/gui/mergeconflicts/find_conflicts.go b/pkg/gui/mergeconflicts/find_conflicts.go
index 3802a66b7..c4d3a51a8 100644
--- a/pkg/gui/mergeconflicts/find_conflicts.go
+++ b/pkg/gui/mergeconflicts/find_conflicts.go
@@ -99,7 +99,7 @@ func FileHasConflictMarkers(path string) (bool, error) {
// Efficiently scans through a file looking for merge conflict markers. Returns true if it does
func fileHasConflictMarkersAux(file io.Reader) bool {
scanner := bufio.NewScanner(file)
- scanner.Split(bufio.ScanLines)
+ scanner.Split(utils.ScanLinesAndTruncateWhenLongerThanBuffer(bufio.MaxScanTokenSize))
for scanner.Scan() {
line := scanner.Bytes()
diff --git a/pkg/tasks/tasks.go b/pkg/tasks/tasks.go
index 202c3f23a..e80b63a2a 100644
--- a/pkg/tasks/tasks.go
+++ b/pkg/tasks/tasks.go
@@ -162,7 +162,7 @@ func (self *ViewBufferManager) NewCmdTask(start func() (*exec.Cmd, io.Reader), p
done := make(chan struct{})
scanner := bufio.NewScanner(r)
- scanner.Split(bufio.ScanLines)
+ scanner.Split(utils.ScanLinesAndTruncateWhenLongerThanBuffer(bufio.MaxScanTokenSize))
lineChan := make(chan []byte)
lineWrittenChan := make(chan struct{})