2005-04-28 18:46:33 +04:00
|
|
|
#ifndef TAG_H
|
|
|
|
#define TAG_H
|
|
|
|
|
|
|
|
#include "object.h"
|
|
|
|
|
|
|
|
extern const char *tag_type;
|
|
|
|
|
|
|
|
struct tag {
|
|
|
|
struct object object;
|
|
|
|
struct object *tagged;
|
|
|
|
char *tag;
|
2017-04-26 22:29:31 +03:00
|
|
|
timestamp_t date;
|
2005-04-28 18:46:33 +04:00
|
|
|
};
|
2018-06-29 04:22:11 +03:00
|
|
|
extern struct tag *lookup_tag(struct repository *r, const struct object_id *oid);
|
2018-06-29 04:22:12 +03:00
|
|
|
extern int parse_tag_buffer(struct repository *r, struct tag *item, const void *data, unsigned long size);
|
2005-04-28 18:50:39 +04:00
|
|
|
extern int parse_tag(struct tag *item);
|
2018-05-16 00:48:42 +03:00
|
|
|
extern void release_tag_memory(struct tag *t);
|
2018-06-29 04:22:20 +03:00
|
|
|
extern struct object *deref_tag(struct repository *r, struct object *, const char *, int);
|
upload-pack: avoid parsing tag destinations
When upload-pack advertises refs, it dereferences any tags
it sees, and shows the resulting sha1 to the client. It does
this by calling deref_tag. That function must load and parse
each tag object to find the sha1 of the tagged object.
However, it also ends up parsing the tagged object itself,
which is not strictly necessary for upload-pack's use.
Each tag produces two object loads (assuming it is not a
recursive tag), when it could get away with only a single
one. Dropping the second load halves the effort we spend.
The downside is that we are no longer verifying the
resulting object by loading it. In particular:
1. We never cross-check the "type" field given in the tag
object with the type of the pointed-to object. If the
tag says it points to a tag but doesn't, then we will
keep peeling and realize the error. If the tag says it
points to a non-tag but actually points to a tag, we
will stop peeling and just advertise the pointed-to
tag.
2. If we are missing the pointed-to object, we will not
realize (because we never even look it up in the object
db).
However, both of these are errors in the object database,
and both will be detected if a client actually requests the
broken objects in question. So we are simply pushing the
verification away from the advertising stage, and down to
the actual fetching stage.
On my test repo with 120K refs, this drops the time to
advertise the refs from ~3.2s to ~2.0s.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-01-06 23:18:01 +04:00
|
|
|
extern struct object *deref_tag_noverify(struct object *);
|
2017-07-13 03:44:15 +03:00
|
|
|
extern int gpg_verify_tag(const struct object_id *oid,
|
2016-04-22 17:52:04 +03:00
|
|
|
const char *name_to_report, unsigned flags);
|
2005-04-28 18:50:39 +04:00
|
|
|
|
2005-04-28 18:46:33 +04:00
|
|
|
#endif /* TAG_H */
|