mirror of
https://github.com/thomiceli/opengist.git
synced 2025-02-12 01:48:02 -05:00
Log parser with maxBytes variable
This commit is contained in:
parent
c3940933bb
commit
9fadfe7cde
2 changed files with 3 additions and 3 deletions
|
@ -126,7 +126,7 @@ func GetLog(user string, gist string, skip string) ([]*Commit, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
return parseLog(stdout), nil
|
||||
return parseLog(stdout, 2<<18), nil
|
||||
}
|
||||
|
||||
func CloneTmp(user string, gist string, gistTmpId string, email string) error {
|
||||
|
|
|
@ -61,7 +61,7 @@ func truncateCommandOutput(out io.Reader, maxBytes int64) (string, bool, error)
|
|||
return string(buf), truncated, nil
|
||||
}
|
||||
|
||||
func parseLog(out io.Reader) []*Commit {
|
||||
func parseLog(out io.Reader, maxBytes int) []*Commit {
|
||||
scanner := bufio.NewScanner(out)
|
||||
|
||||
var commits []*Commit
|
||||
|
@ -164,7 +164,7 @@ func parseLog(out io.Reader) []*Commit {
|
|||
currentFile.Content += string(line) + "\n"
|
||||
|
||||
bytesRead += len(line)
|
||||
if bytesRead > 2<<18 {
|
||||
if bytesRead > maxBytes {
|
||||
currentFile.Truncated = true
|
||||
currentFile.Content = ""
|
||||
isContent = false
|
||||
|
|
Loading…
Add table
Reference in a new issue