MCPcopy Create free account
hub / github.com/git/git / compare_objects

Function compare_objects

builtin/index-pack.c:771–797  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

769};
770
771static int compare_objects(const unsigned char *buf, unsigned long size,
772 void *cb_data)
773{
774 struct compare_data *data = cb_data;
775
776 if (data->buf_size < size) {
777 free(data->buf);
778 data->buf = xmalloc(size);
779 data->buf_size = size;
780 }
781
782 while (size) {
783 ssize_t len = odb_read_stream_read(data->st, data->buf, size);
784 if (len == 0)
785 die(_("SHA1 COLLISION FOUND WITH %s !"),
786 oid_to_hex(&data->entry->idx.oid));
787 if (len < 0)
788 die(_("unable to read %s"),
789 oid_to_hex(&data->entry->idx.oid));
790 if (memcmp(buf, data->buf, len))
791 die(_("SHA1 COLLISION FOUND WITH %s !"),
792 oid_to_hex(&data->entry->idx.oid));
793 size -= len;
794 buf += len;
795 }
796 return 0;
797}
798
799static int check_collison(struct object_entry *entry)
800{

Callers

nothing calls this directly

Calls 4

odb_read_stream_readFunction · 0.85
oid_to_hexFunction · 0.85
xmallocFunction · 0.50
dieFunction · 0.50

Tested by

no test coverage detected