File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -518,7 +518,7 @@ func (r *HunksReader) ReadHunk() (*Hunk, error) {
518
518
// If the line starts with `---` and the next one with `+++` we're
519
519
// looking at a non-extended file header and need to abort.
520
520
if bytes .HasPrefix (line , []byte ("---" )) {
521
- ok , err := nextLineHasPrefix (r .reader , [] byte ( "+++" ) )
521
+ ok , err := peekPrefix (r .reader , "+++" )
522
522
if err != nil {
523
523
return r .hunk , err
524
524
}
@@ -593,17 +593,17 @@ func linePrefix(c byte) bool {
593
593
return false
594
594
}
595
595
596
- // nextLineHasPrefix peeks into the given reader to check whether the next
596
+ // peekPrefix peeks into the given reader to check whether the next
597
597
// bytes match the given prefix.
598
- func nextLineHasPrefix (reader * bufio.Reader , prefix [] byte ) (bool , error ) {
598
+ func peekPrefix (reader * bufio.Reader , prefix string ) (bool , error ) {
599
599
next , err := reader .Peek (len (prefix ))
600
600
if err != nil {
601
601
if err == io .EOF {
602
602
return false , nil
603
603
}
604
604
return false , err
605
605
}
606
- return bytes .HasPrefix (next , prefix ), nil
606
+ return bytes .HasPrefix (next , [] byte ( prefix ) ), nil
607
607
}
608
608
609
609
// normalizeHeader takes a header of the form:
You can’t perform that action at this time.
0 commit comments