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

Function match_pathspec_attrs

pathspec.c:767–803  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

765}
766
767int match_pathspec_attrs(struct index_state *istate,
768 const char *name, int namelen,
769 const struct pathspec_item *item)
770{
771 int i;
772 char *to_free = NULL;
773
774 if (name[namelen])
775 name = to_free = xmemdupz(name, namelen);
776
777 git_check_attr(istate, name, item->attr_check);
778
779 free(to_free);
780
781 for (i = 0; i < item->attr_match_nr; i++) {
782 const char *value;
783 int matched;
784 enum attr_match_mode match_mode;
785
786 value = item->attr_check->items[i].value;
787 match_mode = item->attr_match[i].match_mode;
788
789 if (ATTR_TRUE(value))
790 matched = (match_mode == MATCH_SET);
791 else if (ATTR_FALSE(value))
792 matched = (match_mode == MATCH_UNSET);
793 else if (ATTR_UNSET(value))
794 matched = (match_mode == MATCH_UNSPECIFIED);
795 else
796 matched = (match_mode == MATCH_VALUE &&
797 !strcmp(item->attr_match[i].value, value));
798 if (!matched)
799 return 0;
800 }
801
802 return 1;
803}
804
805int pathspec_needs_expanded_index(struct index_state *istate,
806 const struct pathspec *pathspec)

Callers 2

do_matchFunction · 0.85
match_pathspec_itemFunction · 0.85

Calls 2

xmemdupzFunction · 0.85
git_check_attrFunction · 0.85

Tested by

no test coverage detected