MCPcopy Create free account
hub / github.com/gogs/gogs / ParseDiff

Function ParseDiff

internal/gitutil/diff.go:173–182  ·  view source on GitHub ↗

ParseDiff parses the diff from given io.Reader.

(r io.Reader, maxFiles, maxFileLines, maxLineChars int)

Source from the content-addressed store, hash-verified

171
172// ParseDiff parses the diff from given io.Reader.
173func ParseDiff(r io.Reader, maxFiles, maxFileLines, maxLineChars int) (*Diff, error) {
174 done := make(chan git.SteamParseDiffResult)
175 go git.StreamParseDiff(r, done, maxFiles, maxFileLines, maxLineChars)
176
177 result := <-done
178 if result.Err != nil {
179 return nil, errors.Newf("stream parse diff: %v", result.Err)
180 }
181 return NewDiff(result.Diff), nil
182}
183
184// RepoDiff parses the diff on given revisions of given repository.
185func RepoDiff(repo *git.Repository, rev string, maxFiles, maxFileLines, maxLineChars int, opts ...git.DiffOptions) (*Diff, error) {

Callers 1

GetDiffPreviewMethod · 0.92

Calls 1

NewDiffFunction · 0.85

Tested by

no test coverage detected