summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3c9fc07)
raw | patch | inline | side by side (parent: 3c9fc07)
author | Junio C Hamano <gitster@pobox.com> | |
Fri, 3 Jun 2011 22:32:14 +0000 (15:32 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 6 Jun 2011 05:45:36 +0000 (22:45 -0700) |
Introduce a helper function that takes the type of an object and
tell if it is a delta, as we seem to use this check in many places.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
tell if it is a delta, as we seem to use this check in many places.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/index-pack.c | patch | blob | history |
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 513fbbc55f0ed438ab11e0bc23c2057690aefd36..0216af76af3dd263182d85333de456a3e2667013 100644 (file)
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
}
}
+static int is_delta_type(enum object_type type)
+{
+ return (type == OBJ_REF_DELTA || type == OBJ_OFS_DELTA);
+}
+
static void *get_base_data(struct base_data *c)
{
if (!c->data) {
struct object_entry *obj = c->obj;
- if (obj->type == OBJ_REF_DELTA || obj->type == OBJ_OFS_DELTA) {
+ if (is_delta_type(obj->type)) {
void *base = get_base_data(c->base);
void *raw = get_data_from_pack(obj);
c->data = patch_delta(
struct object_entry *obj = &objects[i];
void *data = unpack_raw_entry(obj, &delta->base);
obj->real_type = obj->type;
- if (obj->type == OBJ_REF_DELTA || obj->type == OBJ_OFS_DELTA) {
+ if (is_delta_type(obj->type)) {
nr_deltas++;
delta->obj_no = i;
delta++;
struct object_entry *obj = &objects[i];
struct base_data base_obj;
- if (obj->type == OBJ_REF_DELTA || obj->type == OBJ_OFS_DELTA)
+ if (is_delta_type(obj->type))
continue;
base_obj.obj = obj;
base_obj.data = NULL;