| 908 | } |
| 909 | |
| 910 | static 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 | |
| 950 | static void prepare_attr_stack(struct index_state *istate, |
| 951 | const struct object_id *tree_oid, |
no test coverage detected