MCPcopy Create free account
hub / github.com/alibaba/open-code-review / looksBinary

Function looksBinary

internal/diff/git.go:645–650  ·  view source on GitHub ↗

looksBinary reports whether content contains a NUL byte within the sniff window — the same marker git uses to report a file as binary.

(content []byte)

Source from the content-addressed store, hash-verified

643// looksBinary reports whether content contains a NUL byte within the sniff
644// window — the same marker git uses to report a file as binary.
645func looksBinary(content []byte) bool {
646 if len(content) > binarySniffWindow {
647 content = content[:binarySniffWindow]
648 }
649 return bytes.IndexByte(content, 0) >= 0
650}
651
652func untrackedBinaryDiff(path string) string {
653 return fmt.Sprintf("diff --git a/%s b/%s\nnew file mode 100644\nBinary files /dev/null and b/%s differ\n", path, path, path)

Callers 1

untrackedFileDiffsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected