Skip to content

Commit 837bd65

Browse files
committed
Rename nextLineHasPrefix to peekPrefix and change signature
1 parent 5726eda commit 837bd65

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

diff/parse.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ func (r *HunksReader) ReadHunk() (*Hunk, error) {
518518
// If the line starts with `---` and the next one with `+++` we're
519519
// looking at a non-extended file header and need to abort.
520520
if bytes.HasPrefix(line, []byte("---")) {
521-
ok, err := nextLineHasPrefix(r.reader, []byte("+++"))
521+
ok, err := peekPrefix(r.reader, "+++")
522522
if err != nil {
523523
return r.hunk, err
524524
}
@@ -593,17 +593,17 @@ func linePrefix(c byte) bool {
593593
return false
594594
}
595595

596-
// nextLineHasPrefix peeks into the given reader to check whether the next
596+
// peekPrefix peeks into the given reader to check whether the next
597597
// 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) {
599599
next, err := reader.Peek(len(prefix))
600600
if err != nil {
601601
if err == io.EOF {
602602
return false, nil
603603
}
604604
return false, err
605605
}
606-
return bytes.HasPrefix(next, prefix), nil
606+
return bytes.HasPrefix(next, []byte(prefix)), nil
607607
}
608608

609609
// normalizeHeader takes a header of the form:

0 commit comments

Comments
 (0)