Skip to content
This repository was archived by the owner on Apr 12, 2019. It is now read-only.

Improve memory usage in Commit.IsImageFile #95

Merged
merged 1 commit into from
Nov 28, 2017
Merged
Changes from all commits
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
3 changes: 2 additions & 1 deletion commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,11 @@ func (c *Commit) IsImageFile(name string) bool {
return false
}

dataRc, err := blob.Data()
dataRc, err := blob.DataAsync()
if err != nil {
return false
}
defer dataRc.Close()
buf := make([]byte, 1024)
n, _ := dataRc.Read(buf)
buf = buf[:n]
Expand Down