summaryrefslogtreecommitdiff
path: root/builtin/pack-objects.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-01-27 18:01:57 -0800
committerJunio C Hamano <gitster@pobox.com>2017-02-01 13:46:52 -0800
commit2aef63d31c338a764099e925d35fe2a9c71348a8 (patch)
tree61d17684220a639cbf92e11b6370db7f0f6d933c /builtin/pack-objects.c
parent7f8641112de8724a565a47b0f0b2a9b826b6baa9 (diff)
downloadgit-2aef63d31c338a764099e925d35fe2a9c71348a8.tar.gz
attr: convert git_check_attrs() callers to use the new API
The remaining callers are all simple "I have N attributes I am interested in. I'll ask about them with various paths one by one". After this step, no caller to git_check_attrs() remains. After removing it, we can extend "struct attr_check" struct with data that can be used in optimizing the query for the specific N attributes it contains. Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/pack-objects.c')
-rw-r--r--builtin/pack-objects.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index 8b8fbd814b..181e4a1985 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -894,24 +894,15 @@ static void write_pack_file(void)
written, nr_result);
}
-static void setup_delta_attr_check(struct attr_check_item *check)
-{
- static struct git_attr *attr_delta;
-
- if (!attr_delta)
- attr_delta = git_attr("delta");
-
- check[0].attr = attr_delta;
-}
-
static int no_try_delta(const char *path)
{
- struct attr_check_item check[1];
+ static struct attr_check *check;
- setup_delta_attr_check(check);
- if (git_check_attrs(path, ARRAY_SIZE(check), check))
+ if (!check)
+ check = attr_check_initl("delta", NULL);
+ if (git_check_attr(path, check))
return 0;
- if (ATTR_FALSE(check->value))
+ if (ATTR_FALSE(check->items[0].value))
return 1;
return 0;
}