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

Function bootstrap_attr_stack

attr.c:910–948  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

908}
909
910static void bootstrap_attr_stack(struct index_state *istate,
911 const struct object_id *tree_oid,
912 struct attr_stack **stack)
913{
914 struct attr_stack *e;
915 unsigned flags = READ_ATTR_MACRO_OK;
916
917 if (*stack)
918 return;
919
920 /* builtin frame */
921 e = read_attr_from_array(builtin_attr);
922 push_stack(stack, e, NULL, 0);
923
924 /* system-wide frame */
925 if (git_attr_system_is_enabled()) {
926 e = read_attr_from_file(git_attr_system_file(), flags);
927 push_stack(stack, e, NULL, 0);
928 }
929
930 /* home directory */
931 if (git_attr_global_file()) {
932 e = read_attr_from_file(git_attr_global_file(), flags);
933 push_stack(stack, e, NULL, 0);
934 }
935
936 /* root directory */
937 e = read_attr(istate, tree_oid, GITATTRIBUTES_FILE, flags | READ_ATTR_NOFOLLOW);
938 push_stack(stack, e, xstrdup(""), 0);
939
940 /* info frame */
941 if (startup_info->have_repository)
942 e = read_attr_from_file(git_path_info_attributes(), flags);
943 else
944 e = NULL;
945 if (!e)
946 CALLOC_ARRAY(e, 1);
947 push_stack(stack, e, NULL, 0);
948}
949
950static void prepare_attr_stack(struct index_state *istate,
951 const struct object_id *tree_oid,

Callers 1

prepare_attr_stackFunction · 0.85

Calls 8

read_attr_from_arrayFunction · 0.85
push_stackFunction · 0.85
read_attr_from_fileFunction · 0.85
git_attr_system_fileFunction · 0.85
git_attr_global_fileFunction · 0.85
read_attrFunction · 0.85
xstrdupFunction · 0.85

Tested by

no test coverage detected