pathspec: allow querying for attributes
[git/git.git] / attr.c
diff --git a/attr.c b/attr.c
index 5493bff..7e21344 100644 (file)
--- a/attr.c
+++ b/attr.c
@@ -603,6 +603,23 @@ struct attr_check *attr_check_initl(const char *one, ...)
        return check;
 }
 
+struct attr_check *attr_check_dup(const struct attr_check *check)
+{
+       struct attr_check *ret;
+
+       if (!check)
+               return NULL;
+
+       ret = attr_check_alloc();
+
+       ret->nr = check->nr;
+       ret->alloc = check->alloc;
+       ALLOC_ARRAY(ret->items, ret->nr);
+       COPY_ARRAY(ret->items, check->items, ret->nr);
+
+       return ret;
+}
+
 struct attr_check_item *attr_check_append(struct attr_check *check,
                                          const struct git_attr *attr)
 {