Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions modules/git/foreachref/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
func NewParser(r io.Reader, format Format) *Parser {
scanner := bufio.NewScanner(r)

// default MaxScanTokenSize = 64 kiB may be too small for some references,
// so allow the buffer to grow up to 4x if needed
buf := make([]byte, 0, bufio.MaxScanTokenSize)
scanner.Buffer(buf, 4 * bufio.MaxScanTokenSize)

Check failure on line 36 in modules/git/foreachref/parser.go

View workflow job for this annotation

GitHub Actions / lint-backend

File is not properly formatted (gofmt)

Check failure on line 36 in modules/git/foreachref/parser.go

View workflow job for this annotation

GitHub Actions / lint-go-windows

File is not properly formatted (gofmt)

Check failure on line 36 in modules/git/foreachref/parser.go

View workflow job for this annotation

GitHub Actions / lint-go-gogit

File is not properly formatted (gofmt)

// in addition to the reference delimiter we specified in the --format,
// `git for-each-ref` will always add a newline after every reference.
refDelim := make([]byte, 0, len(format.refDelim)+1)
Expand Down Expand Up @@ -70,6 +75,9 @@
// { "objecttype": "tag", "refname:short": "v1.16.4", "object": "f460b7543ed500e49c133c2cd85c8c55ee9dbe27" }
func (p *Parser) Next() map[string]string {
if !p.scanner.Scan() {
if err := p.scanner.Err(); err != nil {
p.err = err
}
return nil
}
fields, err := p.parseRef(p.scanner.Text())
Expand Down
Loading