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

Function looksBinary

internal/diff/git.go:651–656  ·  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

649// looksBinary reports whether content contains a NUL byte within the sniff
650// window — the same marker git uses to report a file as binary.
651func looksBinary(content []byte) bool {
652 if len(content) > binarySniffWindow {
653 content = content[:binarySniffWindow]
654 }
655 return bytes.IndexByte(content, 0) >= 0
656}
657
658func untrackedBinaryDiff(path string) string {
659 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