attr: push the bare repo check into read_attr()
[gitweb.git] / convert.c
index 1b9829279f1ad9a26899d4b653003cc63fbdf90a..8d652bf27c9444d3696c4b942dc85f062e2bf53e 100644 (file)
--- a/convert.c
+++ b/convert.c
@@ -1085,24 +1085,19 @@ struct conv_attrs {
        int ident;
 };
 
-static const char *conv_attr_name[] = {
-       "crlf", "ident", "filter", "eol", "text",
-};
-#define NUM_CONV_ATTRS ARRAY_SIZE(conv_attr_name)
-
 static void convert_attrs(struct conv_attrs *ca, const char *path)
 {
-       int i;
-       static struct attr_check_item ccheck[NUM_CONV_ATTRS];
+       static struct attr_check *check;
 
-       if (!ccheck[0].attr) {
-               for (i = 0; i < NUM_CONV_ATTRS; i++)
-                       ccheck[i].attr = git_attr(conv_attr_name[i]);
+       if (!check) {
+               check = attr_check_initl("crlf", "ident", "filter",
+                                        "eol", "text", NULL);
                user_convert_tail = &user_convert;
                git_config(read_convert_config, NULL);
        }
 
-       if (!git_check_attrs(path, NUM_CONV_ATTRS, ccheck)) {
+       if (!git_check_attr(path, check)) {
+               struct attr_check_item *ccheck = check->items;
                ca->crlf_action = git_path_check_crlf(ccheck + 4);
                if (ca->crlf_action == CRLF_UNDEFINED)
                        ca->crlf_action = git_path_check_crlf(ccheck + 0);