commit - ae23ce34e8072d9add04d0182d11c532443e70e8
commit + 07165b171f54dc3e3cd64bd7238e5d060d0c90aa
blob - 5613eb657783b5cccea0bc9778d303db8478e70e
blob + e18f0ca3920ec76e50fd90d999b3192143dbf35c
--- lib/pack_create.c
+++ lib/pack_create.c
err = NULL;
return err;
}
+
+static const int obj_types[] = {
+ GOT_OBJ_TYPE_ANY,
+ GOT_OBJ_TYPE_COMMIT,
+ GOT_OBJ_TYPE_TREE,
+ GOT_OBJ_TYPE_BLOB,
+ GOT_OBJ_TYPE_TAG,
+ GOT_OBJ_TYPE_OFFSET_DELTA,
+ GOT_OBJ_TYPE_REF_DELTA
+};
static const struct got_error *
add_meta(struct got_pack_metavec *v, struct got_object_idset *idset,
return NULL;
}
- err = got_object_idset_add(idset, id, NULL);
+ err = got_object_idset_add(idset, id, (void *)&obj_types[obj_type]);
if (err)
return err;
continue;
}
- err = got_object_idset_add(drop, qid->id, NULL);
+ err = got_object_idset_add(drop, qid->id,
+ (void *)&obj_types[GOT_OBJ_TYPE_COMMIT]);
if (err) {
got_object_qid_free(qid);
break;
goto done;
}
if (qcolor == COLOR_KEEP)
- err = got_object_idset_add(keep, id, NULL);
+ err = got_object_idset_add(keep, id,
+ (void *)&obj_types[GOT_OBJ_TYPE_COMMIT]);
else
- err = got_object_idset_add(drop, id, NULL);
+ err = got_object_idset_add(drop, id,
+ (void *)&obj_types[GOT_OBJ_TYPE_COMMIT]);
if (err) {
free(id);
goto done;
for (i = 0; i < ntheirs; i++) {
struct got_object_id *id = theirs[i];
+ int *cached_type;
if (id == NULL)
continue;
- err = got_object_get_type(&obj_type, repo, id);
- if (err)
- return err;
+ cached_type = got_object_idset_get(idset, id);
+ if (cached_type == NULL) {
+ err = got_object_get_type(&obj_type, repo, id);
+ if (err)
+ goto done;
+ } else
+ obj_type = *cached_type;
if (obj_type != GOT_OBJ_TYPE_TAG)
continue;
err = load_tag(NULL, idset, id, repo,
for (i = 0; i < nours; i++) {
struct got_object_id *id = ours[i];
+ int *cached_type;
if (id == NULL)
continue;
- err = got_object_get_type(&obj_type, repo, id);
- if (err)
- return err;
+ cached_type = got_object_idset_get(idset, id);
+ if (cached_type == NULL) {
+ err = got_object_get_type(&obj_type, repo, id);
+ if (err)
+ goto done;
+ } else
+ obj_type = *cached_type;
if (obj_type != GOT_OBJ_TYPE_TAG)
continue;
err = load_tag(&v, idset, id, repo,