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

Function read_attr_from_buf

attr.c:735–764  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

733}
734
735static struct attr_stack *read_attr_from_buf(char *buf, size_t length,
736 const char *path, unsigned flags)
737{
738 struct attr_stack *res;
739 char *sp;
740 int lineno = 0;
741
742 if (!buf)
743 return NULL;
744 if (length >= ATTR_MAX_FILE_SIZE) {
745 warning(_("ignoring overly large gitattributes blob '%s'"), path);
746 free(buf);
747 return NULL;
748 }
749
750 CALLOC_ARRAY(res, 1);
751 for (sp = buf; *sp;) {
752 char *ep;
753 int more;
754
755 ep = strchrnul(sp, '\n');
756 more = (*ep == '\n');
757 *ep = '\0';
758 handle_attr_line(res, sp, path, ++lineno, flags);
759 sp = ep + more;
760 }
761 free(buf);
762
763 return res;
764}
765
766static struct attr_stack *read_attr_from_blob(struct index_state *istate,
767 const struct object_id *tree_oid,

Callers 2

read_attr_from_blobFunction · 0.85
read_attr_from_indexFunction · 0.85

Calls 2

warningFunction · 0.85
handle_attr_lineFunction · 0.85

Tested by

no test coverage detected