| 74 | } |
| 75 | |
| 76 | struct object *deref_tag(struct repository *r, struct object *o, const char *warn, int warnlen) |
| 77 | { |
| 78 | struct object_id *last_oid = NULL; |
| 79 | while (o && o->type == OBJ_TAG) |
| 80 | if (((struct tag *)o)->tagged) { |
| 81 | last_oid = &((struct tag *)o)->tagged->oid; |
| 82 | o = parse_object(r, last_oid); |
| 83 | } else { |
| 84 | last_oid = NULL; |
| 85 | o = NULL; |
| 86 | } |
| 87 | if (!o && warn) { |
| 88 | if (last_oid && is_promisor_object(r, last_oid)) |
| 89 | return NULL; |
| 90 | if (!warnlen) |
| 91 | warnlen = strlen(warn); |
| 92 | error("missing object referenced by '%.*s'", warnlen, warn); |
| 93 | } |
| 94 | return o; |
| 95 | } |
| 96 | |
| 97 | struct tag *lookup_tag(struct repository *r, const struct object_id *oid) |
| 98 | { |