helper/test-ref-store: fix "new-sha1" vs "old-sha1" typo
[gitweb.git] / ws.c
diff --git a/ws.c b/ws.c
index ea4b2b1dfd64ce41f4752a93f4d5478c4e53deda..a07caedd5a565bbf29e4f9b3036ac60e6e9f716e 100644 (file)
--- a/ws.c
+++ b/ws.c
@@ -71,24 +71,17 @@ unsigned parse_whitespace_rule(const char *string)
        return rule;
 }
 
-static void setup_whitespace_attr_check(struct git_attr_check *check)
-{
-       static struct git_attr *attr_whitespace;
-
-       if (!attr_whitespace)
-               attr_whitespace = git_attr("whitespace");
-       check[0].attr = attr_whitespace;
-}
-
 unsigned whitespace_rule(const char *pathname)
 {
-       struct git_attr_check attr_whitespace_rule;
+       static struct attr_check *attr_whitespace_rule;
+
+       if (!attr_whitespace_rule)
+               attr_whitespace_rule = attr_check_initl("whitespace", NULL);
 
-       setup_whitespace_attr_check(&attr_whitespace_rule);
-       if (!git_check_attr(pathname, 1, &attr_whitespace_rule)) {
+       if (!git_check_attr(pathname, attr_whitespace_rule)) {
                const char *value;
 
-               value = attr_whitespace_rule.value;
+               value = attr_whitespace_rule->items[0].value;
                if (ATTR_TRUE(value)) {
                        /* true (whitespace) */
                        unsigned all_rule = ws_tab_width(whitespace_rule_cfg);